<fanel ID="anel1" runat="server" ShowBorder="false" Width="783px" ShowHeader="false"
Height="455px" Layout="HBox" BoxConfigAlign="Stretch" BoxConfigPosition="Start">
<Items>
<f:Grid ID="Grid1" runat="server" ShowHeader="false" ShowBorder="false" Width="200px"
DataKeyNames="编号,名称" EnableRowDoubleClickEvent="true" OnRowDoubleClick="Grid1_RowClick">
<Columns>
<f:BoundField DataField="编号" Width="70px" HeaderText="双击编号(将编号移到右边)" ExpandUnusedSpace="true"
ID="ctl02" ColumnID="Window1_RegionPanel1_Region1_Panel2_Grid1_ctl02"></f:BoundField>
</Columns>
</f:Grid>
<f:Grid ID="Grid2" ShowBorder="false" ShowHeader="false" Title="表格" BoxFlex="1"
Height="400px" runat="server" AllowCellEditing="true" ClicksToEdit="1">
<Columns>
<f:BoundField Width="100px" ColumnID="A1" DataField="编号" HeaderText="编号" />
<f:BoundField Width="100px" ColumnID="A2" Hidden="true" DataField="名称" HeaderText="名称" />
</Columns>
</f:Grid>
</Items>
</fanel>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
DataTable dt = new DataTable();
dt.Columns.Add("编号", typeof(System.String));
dt.Columns.Add("名称", typeof(System.String));
DataRow dr = dt.NewRow();
dr[0] = "1";
dr[1] = "A1";
dt.Rows.Add(dr);
dr = dt.NewRow();
dr[0] = "2";
dr[1] = "A2";
dt.Rows.Add(dr);
dr = dt.NewRow();
dr[0] = "3";
dr[1] = "A3";
dt.Rows.Add(dr);
dr = dt.NewRow();
dr[0] = "4";
dr[1] = "A4";
dt.Rows.Add(dr);
Grid1.DataSource = dt;
Grid1.DataBind();
}
}
protected void AddRow(string ss1,string ss2)
{
JObject defaultObj = new JObject();
defaultObj.Add("A1", ss1);
defaultObj.Add("A2", ss2);
FineUI.PageContext.RegisterStartupScript(Grid2.GetAddNewRecordReference(defaultObj, false));
}
protected void Grid1_RowClick(object sender, FineUI.GridRowClickEventArgs e)
{
object[] key1 = Grid1.DataKeys[e.RowIndex];
AddRow(key1[0].ToString(), key1[1].ToString());
Grid1.Rows.RemoveAt(e.RowIndex);
} |