SHOWcode
2018年4月18日 星期三
C#.NET Gridviewn 塞 CheckBox AND TextBox (含取直)
Gridviewn塞CheckBox AND TextBox
=======.ASPX========
<asp:GridView ID="gview" runat="server" >
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:CheckBox ID="CheckBox1" runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField HeaderText="NAME01" DataField="NAME01" />
<asp:BoundField HeaderText="NAME02" DataField="NAME02" />
<asp:BoundField HeaderText="NAME03" DataField="NAME03" />
<asp:TemplateField HeaderText="NAME04">
<ItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
=======.CS===========
#region 判斷勾選與取值
protected void bt_Click(object sender, EventArgs e)
{
String test = "";
String test_text = "";
int total = 0;
for (int i = 0; i < gview.Rows.Count; i++)
{
GridViewRow gvr = gview.Rows[i];
CheckBox ckb = (CheckBox)gvr.FindControl("CheckBox1");
TextBox tb = (TextBox)gvr.FindControl("TextBox1");
if (ckb.Checked == true)
{
test = gvr.Cells[1].Text.ToString().Trim();
test_text = tb.Text.ToString().Trim();
}
}
}
訂閱:
張貼留言 (Atom)
Jenkins-mail
參考:http://www.linuxea.com/1767.html 前置作業略過~有空再補 Mailer Plugin post { success { emailext ( subject: &...
-
ASP.NET刷新頁面的六種方法 第一: private void Button1_Click( object sender, System.EventArgs e ) { Response.Redirect( Request.Url.ToSt...
-
foreach (string fname in System.IO.Directory.GetFileSystemEntries(@"C:\Users\joshs")) { //if (fn...
沒有留言:
張貼留言