HTML code:
<asp:gridview id= "GridView1" runat= "Server" datakeynames= "CKDH" height= "183px" style= "left:0px";
position:relative; Top: -18px; Font-size:small; "
Width= "864px" allowpaging= "true" allowsorting= "true" autogeneratecolumns= "False" datasourceid= "SqlDataSource1" autogenerateselectbutton= "True" cellpadding= "4" forecolor= "#333333" gridlines= "None" onselectedindexchanging= " Gridview1_selectedindexchanging "emptydatatext=" not entered "> <pagerstyle horizontalalign=" Right "BackColor=" #FFC C66 "forecolor=" #333333 "/> <pagersettings mode=" Nextpreviousfirstlast "firstpagetext=" first page "Previouspaget ext= "Previous page" nextpagetext= "Next" lastpagetext= "last Page"/> <Columns> <asp:boundfield Data Field= "CKDH" headertext= "out of the library number" sortexpression= "CKDH"/> <asp:boundfield "datafield=" ckkb = "Out of the Library" sortexpression= "ckkb"/> <asp:boundfield datafield= "ypqx" headertext= "Drug whereabouts" Sortexpression= "Ypqx"/> <asp:boundfield datafield= "YPBH" headertext= "drug number" sortexpression= "YPBH"/> <asp:boundfield datafield= "YPMC" headertext= "Drug name" sortexpression= "YPMC"/> <asp: BoundField datafield= "GG" headertext= "Pharmaceutical Specifications" sortexpression= "GG"/> <asp:boundfield "DW" headertext= "Drug unit" sortexpression= "DW"/> <asp:boundfield datafield= "sj" headertext= "out of the library price" Sortexpre
ssion= "SJ"/> <asp:boundfield datafield= "SL" headertext= "number of out of stock" sortexpression= "SL"/>
</Columns> <selectedrowstyle forecolor= "Navy" backcolor= "#FFCC66" font-bold= "True"/> <rowstyle forecolor= "#333333" backcolor= "#FFFBD6"/> <footerstyle backcolor= "#990000" font-bold= "Tru
E "forecolor="/>
See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/webkf/aspx/
C # Background code:
protected void Gridview1_selectedindexchanging (object sender, GridViewSelectEventArgs a) {TextBox1.Text = Gr Idview1.rows[a.newselectedindex]. CELLS[1].
Text.tostring (); TextBox2.Text = Gridview1.rows[a.newselectedindex]. CELLS[2].
Text.tostring (); TextBox3.Text = Gridview1.rows[a.newselectedindex]. CELLS[3].
Text.tostring (); Textbox4.text = Gridview1.rows[a.newselectedindex]. CELLS[4].
Text.tostring (); Textbox5.text = Gridview1.rows[a.newselectedindex]. CELLS[5].
Text.tostring (); Textbox6.text = Gridview1.rows[a.newselectedindex]. CELLS[6].
Text.tostring (); Textbox7.text = Gridview1.rows[a.newselectedindex]. CELLS[7].
Text.tostring (); Textbox8.text = Gridview1.rows[a.newselectedindex]. CELLS[8].
Text.tostring (); Textbox9.text = Gridview1.rows[a.newselectedindex]. CELLS[9].
Text.tostring ();
session["Shuliang"] = Convert.ToInt32 (Textbox9.text); Textbox10.text = Gridview1.rows[e.newselectedindex]. CELLS[10]. Text.
ToString (); Textbox11.text = Gridview1.rows[e.newselectedindex]. CELLS[11].
Text.tostring (); TextBox1.Text = Gridview1.rows[e.newselectedindex]. CELLS[1].
Text.tostring ();
Response.Write ("