1. aspx code. Because there is another table outside the textbox of the cell in the Gridview, several children [] are used. I hope there is a better way. I will not talk about the easyui pop-up layer and understand it all.
<Head runat = "server">
<Title> </title>
<Link href = "themes/default/easyui.css" rel = "stylesheet" type = "text/css"/>
<Link href = "themes/icon.css" rel = "stylesheet" type = "text/css"/>
<Script src = "jquery-1.4.2.min.js" type = "text/javascript"> </script>
<Script src = "js/jquery. easyui. min. js" type = "text/javascript"> </script>
<Script type = "text/javascript">
$ (Function (){
$ ('# Dlg'). dialog ('close ')
});
</Script>
<Script type = "text/javascript">
Function showDivObj (objThis, gridviewId, cellIndex ){
Var table = document. getElementById ($ ("table [id * = '" + gridviewId + "']"). attr ("id "));
For (index = 1; index <table. rows. length; index ++ ){
If (objThis. id = table. rows [index]. cells [3]. children [0]. id ){
$ ("Input [id * = 'txtceshi1']"). val (table. rows [index]. cells [1]. innerHTML );
$ ("Input [id * = 'txtceshi2']"). val (table. rows [index]. cells [2]. children [0]. children [0]. children [1]. children [0]. children [0]. innerText); // lable Value
$ ("Input [id * = 'txtceshi3']"). val (table. rows [index]. cells [2]. children [0]. children [0]. children [0]. children [0]. children [0]. value); // textbox value
// $ ('# Dlg'). dialog ({modal: true });
$ ('# Dlg'). dialog ('open ');
Return false;
}
}
}
</Script>
</Head>
<Body>
<Form id = "form1" runat = "server">
<Asp: ScriptManager ID = "ScriptManager1" runat = "server">
</Asp: ScriptManager>
<Asp: TextBox ID = "TextBox1" runat = "server"> </asp: TextBox>
<Asp: UpdatePanel ID = "UpdatePanel1" runat = "server">
<ContentTemplate>
<Div>
<Asp: GridView ID = "gdv" runat = "server" onkeydown = 'Return keyPressed () 'AllowPaging = "True"
PageSize = "50" AutoGenerateColumns = "False" Width = "100%" PagerStyle-HorizontalAlign = "Center">
<PagerSettings Visible = "False"/>
<PagerStyle HorizontalAlign = "Center"/>
<RowStyle HorizontalAlign = "Center"/>
<Columns>
<Asp: TemplateField HeaderText = "no.">
<ItemTemplate>
<Asp: Label ID = "lbl" runat = "server" Text = "<% # Container. DataItemIndex + 1%>"> </asp: Label>
</ItemTemplate>
</Asp: TemplateField>
<Asp: BoundField DataField = "Name" HeaderText = "test"/>
<Asp: TemplateField HeaderText = "name">
<ItemTemplate>
<Table>
<Tr>
<Td>
<Asp: TextBox ID = "BarCode" runat = "server" Text = '<% # Eval ("HousesID") %> 'width = "200px"
MaxLength = "10"> </asp: TextBox>
</Td>
</Tr>
<Tr>
<Td>
<Asp: Label ID = "Label1" runat = "server" Text = '<% # Eval ("HousesID") %>'> </asp: Label>
</Td>
</Tr>
</Table>
</ItemTemplate>
</Asp: TemplateField>
<Asp: TemplateField HeaderText = "edit">
<ItemTemplate>
<Asp: LinkButton ID = "LinkButton1" runat = "server" OnClientClick = "showDivObj (this, 'gdv', 5)"> edit </asp: LinkButton>
</ItemTemplate>
</Asp: TemplateField>
</Columns>
</Asp: GridView>
</Div>
</ContentTemplate>
</Asp: UpdatePanel>
<Div id = "dlg" class = "easyui-dialog" title = "Toolbar and Buttons" style = "width: 400px;
Height: 200px; padding: 10px ">
1: <asp: TextBox ID = "txtceshi1" runat = "server" Width = "200px" MaxLength = "10"> </asp: TextBox> </br>
2: <asp: TextBox ID = "txtceshi2" runat = "server" Width = "200px" MaxLength = "10"> </asp: TextBox> </br>
3: <asp: TextBox ID = "txtceshi3" runat = "server" Width = "200px" MaxLength = "10"> </asp: TextBox>
<Asp: Button ID = "Button1" runat = "server" Text = "OK"/>
<Asp: Button ID = "Button2" runat = "server" Text = "cancel" OnClientClick = "$ ('# dlg'). dialog ('close')"/>
</Div>
</Form>
</Body>
2. cs code
List <SeeList> list = new List <SeeList> ();
Protected void Page_Load (object sender, EventArgs e)
{
SeeList li = new SeeList ();
Li. AutoID = 1;
Li. HousesID = 21;
Li. Name = "asd1 ";
List. Add (li );
SeeList li2 = new SeeList ();
Li2.AutoID = 1;
Li2.HousesID = 22;
Li2.Name = "asd2 ";
List. Add (li2 );
SeeList li3 = new SeeList ();
Li3.AutoID = 1;
Li3.HousesID = 23;
Li3.Name = "asd3 ";
List. Add (li3 );
SeeList li4 = new SeeList ();
Li4.AutoID = 1;
Li4.HousesID = 24;
Li4.Name = "asd4 ";
List. Add (li4 );
SeeList li5 = new SeeList ();
Li5.AutoID = 1;
Li5.HousesID = 25;
Li5.Name = "asd5 ";
List. Add (li5 );
Gdv. DataSource = list;
Gdv. DataBind ();
}
# Region entity
Public class SeeList
{
Private int m_AutoID;
Public int AutoID
{
Get {return m_AutoID ;}
Set {m_AutoID = value ;}
}
Private int m_HousesID;
Public int HousesID
{
Get {return m_HousesID ;}
Set {m_HousesID = value ;}
}
Private string m_Name;
Public string Name
{
Get {return m_Name ;}
Set {m_Name = value ;}
}
}
# Endregion