在asp.net webform中的 gridview 里面的一些基本操作

  1. <body>
  2. <form id="form1" runat="server">
  3. <table id="Table1" cellspacing="0" cellpadding="0" width="100%" border="0">
  4. <tr>
  5. <td>
  6. <asp:Panel ID="ToolbarPanel" runat="server" CssClass="buttonContainer" Wrap="False"
  7. Width="100%">
  8. <asp:Button ID="btnQuery" runat="server" CssClass="buttonOut" Text="查询" Width="40px"
  9. OnClick="btnQuery_Click"></asp:Button>
  10. <asp:Button ID="btnSave" runat="server" Enabled="False" CssClass="buttonOut" Text="保存"
  11. OnClick="btnSave_Click"></asp:Button>
  12. <asp:Button ID="Button2" runat="server" Enabled="False" CssClass="buttonOut" Text="检测身份证是否上传"
  13. OnClick="Button2_Click"></asp:Button>
  14. </asp:Panel>
  15. </td>
  16. </tr>
  17. <tr>
  18. <td>
  19. <asp:Panel ID="Panel1" runat="server" Visible="false" Height="187px" Width="1626px">
  20. <table align="center">
  21. <tr>
  22. <td class="style2">
  23. <font size="4">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;是否上传身份证:
  24. <%-- <asp:Label ID="lblisload" runat="server" Text="Label" Style="color: Green"></asp:Label>--%>
  25. <asp:RadioButton Text="是" ID="RadioButton1" GroupName="a" runat="server" />
  26. <asp:RadioButton Text="否" ID="RadioButton2" GroupName="a" runat="server" />
  27. <asp:RadioButton Text="未检测" ID="RadioButton3" GroupName="a" runat="server" />
  28. <asp:Label runat="server" Style="color: Red">3个按钮是需要选择修改的时候选择用的!</asp:Label>
  29. </font>
  30. </td>
  31. </tr>
  32. <tr>
  33. <td class="style1">
  34. <font size="4">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  35. 收货人:<asp:Label ID="lblshr" runat="server" Text="Label" Style="color: Green"></asp:Label></font>
  36. </td>
  37. </tr>
  38. <tr>
  39. <td class="style1">
  40. <font size="4">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  41. 买家账号:<asp:Label ID="lblmjzh" runat="server" Text="Label" Style="color: Green"></asp:Label></font>
  42. </td>
  43. </tr>
  44. <tr>
  45. <td class="style1">
  46. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  47. 网店店名<font size="4">:<asp:Label ID="lblwddm" runat="server" Style="color: Green" Text="Label"></asp:Label>
  48. </font>
  49. </td>
  50. </tr>
  51. <tr>
  52. <td class="style2">
  53. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  54. 订单号<font size="4">:<asp:Label ID="lblddh" runat="server" Style="color: Green" Text="Label"></asp:Label>
  55. </font>
  56. </td>
  57. </tr>
  58. <tr>
  59. <td class="style1">
  60. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  61. 付款<font size="4">时间:<asp:Label ID="lblfksj" runat="server" Style="color: Green" Text="Label"></asp:Label>
  62. </font>
  63. </td>
  64. </tr>
  65. <tr>
  66. <td class="style2">
  67. <font size="4">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  68. 下单时间:<asp:Label ID="lblxdsj" runat="server" Text="Label" Style="color: Green"></asp:Label></font>
  69. </td>
  70. </tr>
  71. <tr>
  72. <td class="style1">
  73. <font size="4">&nbsp;&nbsp;&nbsp;</font>
  74. </td>
  75. </tr>
  76. <tr>
  77. <td class="style1">
  78. <font size="4">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font>
  79. </td>
  80. </tr>
  81. </table>
  82. </asp:Panel>
  83. </td>
  84. </tr>
  85. <tr>
  86. <td>
  87. <asp:Panel ID="Panel2" runat="server">
  88. <table>
  89. <tr>
  90. <td>
  91. <font size="2">买家账号:<asp:TextBox ID="mjzh" runat="server" CssClass="flat"></asp:TextBox></font>
  92. </td>
  93. <td>
  94. <font size="2">收货 人:<asp:TextBox ID="shr" runat="server" CssClass="flat"></asp:TextBox></font>
  95. </td>
  96. <td>
  97. <font size="2">订单编号:<asp:TextBox ID="ddbh" runat="server" CssClass="flat"></asp:TextBox></font>
  98. </td>
  99. <td align="right">
  100. <font size="2">开始日期:</font>
  101. </td>
  102. <td>
  103. <asp:TextBox ID="txtzdrq1" runat="server" CssClass="flat" Width="90"></asp:TextBox>&nbsp;
  104. </td>
  105. <td align="right">
  106. <font size="2">截止日期:</font>
  107. </td>
  108. <td>
  109. <asp:TextBox ID="txtzdrq2" runat="server" CssClass="flat" Width="90"></asp:TextBox>
  110. </td>
  111. <td>
  112. <asp:Button ID="Button1" runat="server" Text="查询" CssClass="QueryCss" OnClick="Button1_Click" />
  113. </td>
  114. </tr>
  115. </table>
  116. </asp:Panel>
  117. <!--OnRowEditing="CardID_RowEditing"-->
  118. <asp:Panel ID="panel3" runat="server">
  119. <asp:GridView ID="CardID" runat="server" AllowPaging="True" PageSize="20" AutoGenerateColumns="False"
  120. OnPageIndexChanging="CardID_PageIndexChanging" Width="1805px" OnRowDataBound="CardID_RowDataBound"
  121. DataKeyNames="tid" OnRowCommand="CardID_RowCommand">
  122. <HeaderStyle HorizontalAlign="Center" BackColor="SkyBlue"></HeaderStyle>
  123. <Columns>
  124. <asp:TemplateField>
  125. <HeaderTemplate>
  126. <asp:CheckBox ID="chkAll" runat="server" AutoPostBack="True" OnCheckedChanged="chkAll_CheckedChanged" />
  127. </HeaderTemplate>
  128. <ItemTemplate>
  129. <asp:CheckBox ID="chkItem" runat="server" />
  130. </ItemTemplate>
  131. <ItemStyle HorizontalAlign="Center" Height=""></ItemStyle>
  132. </asp:TemplateField>
  133. <asp:TemplateField HeaderText="序号">
  134. <ItemTemplate>
  135. <%#Container.DataItemIndex+1%>
  136. </ItemTemplate>
  137. <ItemStyle HorizontalAlign="Center" Height=""></ItemStyle>
  138. </asp:TemplateField>
  139. <asp:TemplateField HeaderText="编辑">
  140. <ItemTemplate>
  141. <asp:LinkButton ID="lbtnQianRu" runat="server" CommandName="tid" CommandArgument='<%# Eval("tid") %>'>详情</asp:LinkButton>
  142. </ItemTemplate>
  143. <ItemStyle HorizontalAlign="Center" Height=""></ItemStyle>
  144. </asp:TemplateField>
  145. <%-- <asp:CommandField HeaderText="编辑" ItemStyle-HorizontalAlign="Center" ShowEditButton="True"
  146. EditText="详情">
  147. <ItemStyle HorizontalAlign="Center" />
  148. </asp:CommandField>--%>
  149. <asp:TemplateField HeaderText="是否上传身份证" SortExpression="a.isload Desc">
  150. <ItemTemplate>
  151. <asp:Label ID="lblIsload" Text='<%# DataBinder.Eval(Container.DataItem, "isload")%>'
  152. runat="server"></asp:Label>
  153. <asp:Label ID="lblisloadID" Visible="false" Text='<%# DataBinder.Eval(Container.DataItem, "isload")%>'
  154. runat="server"></asp:Label>
  155. </ItemTemplate>
  156. <ItemStyle HorizontalAlign="Center" />
  157. </asp:TemplateField>
  158. <asp:BoundField DataField="receiver_name" HeaderText="收货人" SortExpression="receiver_name"
  159. ItemStyle-HorizontalAlign="Center">
  160. <ItemStyle HorizontalAlign="Center" Height=""></ItemStyle>
  161. </asp:BoundField>
  162. <asp:BoundField DataField="buyer_nick" HeaderText="买家账号" SortExpression="buyer_nick"
  163. ItemStyle-HorizontalAlign="Center">
  164. <ItemStyle HorizontalAlign="Center" Height=""></ItemStyle>
  165. </asp:BoundField>
  166. <asp:BoundField DataField="seller_nick" HeaderText="网店店名" SortExpression="seller_nick"
  167. ItemStyle-HorizontalAlign="Center">
  168. <ItemStyle HorizontalAlign="Center" Height=""></ItemStyle>
  169. </asp:BoundField>
  170. <asp:BoundField DataField="tid" HeaderText="订单号" SortExpression="tid" ItemStyle-HorizontalAlign="Center">
  171. <ItemStyle HorizontalAlign="Center" Height=""></ItemStyle>
  172. </asp:BoundField>
  173. <asp:BoundField DataField="pay_time" HeaderText="付款时间" SortExpression="pay_time"
  174. ItemStyle-HorizontalAlign="Center">
  175. <ItemStyle HorizontalAlign="Center" Height=""></ItemStyle>
  176. </asp:BoundField>
  177. <asp:BoundField DataField="modified" HeaderText="下单时间" SortExpression="modified"
  178. ItemStyle-HorizontalAlign="Center">
  179. <ItemStyle HorizontalAlign="Center" Height=""></ItemStyle>
  180. </asp:BoundField>
  181. </Columns>
  182. <%-- <FooterStyle BackColor="#F7DFB5" ForeColor="#8C4510" />
  183. <HeaderStyle BackColor="#A55129" Font-Bold="True" ForeColor="White" />
  184. <RowStyle BackColor="#FFF7E7" ForeColor="#8C4510" />
  185. <SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="White" />--%>
  186. <PagerStyle ForeColor="#8C4510" HorizontalAlign="Center" />
  187. <PagerTemplate>
  188. <br />
  189. <asp:Label ID="lblPage" runat="server" Text='<%# "第" + (((GridView)Container.NamingContainer).PageIndex + 1) + "页/共" + (((GridView)Container.NamingContainer).PageCount) + "页" %> '></asp:Label>
  190. <asp:LinkButton ID="lbnFirst" runat="Server" Text="首页" Enabled='<%# ((GridView)Container.NamingContainer).PageIndex != 0 %>'
  191. CommandName="Page" CommandArgument="First"></asp:LinkButton>
  192. <asp:LinkButton ID="lbnPrev" runat="server" Text="上一页" Enabled='<%# ((GridView)Container.NamingContainer).PageIndex != 0 %>'
  193. CommandName="Page" CommandArgument="Prev"></asp:LinkButton>
  194. <asp:LinkButton ID="lbnNext" runat="Server" Text="下一页" Enabled='<%# ((GridView)Container.NamingContainer).PageIndex != (((GridView)Container.NamingContainer).PageCount - 1) %>'
  195. CommandName="Page" CommandArgument="Next"></asp:LinkButton>
  196. <asp:LinkButton ID="lbnLast" runat="Server" Text="尾页" Enabled='<%# ((GridView)Container.NamingContainer).PageIndex != (((GridView)Container.NamingContainer).PageCount - 1) %>'
  197. CommandName="Page" CommandArgument="Last"></asp:LinkButton>
  198. </PagerTemplate>
  199. </asp:GridView>
  200. </asp:Panel>
  201. </td>
  202. </tr>
  203. </table>
  204. </form>
  205. </body>
  206.  
  207. 后台代码.cs文件
  208. //窗体的加载事件
  209. protected new void Page_Load(object sender, EventArgs e)
  210. {
  211. base.Page_Load(sender, e);
  212. if (!IsPostBack)
  213. {
  214. this.txtzdrq2.Text = DateTime.Now.ToString();
  215. DateTime t = DateTime.Now.AddDays(-7);
  216. this.txtzdrq1.Text = t.ToString();
  217. }
  218. }
  219. //顶部的查询按钮
  220. protected void btnQuery_Click(object sender, EventArgs e)
  221. {
  222. Panel1.Visible = false;
  223. Panel2.Visible = true;
  224. panel3.Visible = true;
  225. Button2.Enabled = true;
  226. btnQuery.Enabled = true;
  227. btnSave.Enabled = false;
  228. this.mjzh.Text = "";
  229. this.shr.Text = "";
  230. this.ddbh.Text = "";
  231. string sql = "";
  232. sql = @"select isload, receiver_name, buyer_nick, seller_nick,tid,pay_time ,modified from tbtrade order by modified desc";
  233. DataTable dt = IFACE.DBUtility.DbHelperSQL.QueryDT(sql);
  234. if (dt != null && dt.Rows.Count > 0)
  235. {
  236. CardID.DataSource = dt;
  237. CardID.DataBind();
  238. }
  239. }
  240. //定义绑定数据的方法,里面包括模糊查询
  241. public void bind()
  242. {
  243. string sql = "";
  244. sql = @"select isload, receiver_name, buyer_nick, seller_nick,tid,pay_time ,modified from tbtrade where 1=1";
  245. if (mjzh.Text.Trim().Replace("'", "") != null && mjzh.Text.Trim().Replace("'", "") != "")
  246. {
  247. sql += "and buyer_nick like'" + mjzh.Text.Trim().Replace("'", "") + "'";
  248. }
  249. if (shr.Text.Trim().Replace("'", "") != null && shr.Text.Trim().Replace("'", "") != "")
  250. {
  251. sql += "and receiver_name like'" + shr.Text.Trim().Replace("'", "") + "'";
  252. }
  253. if (ddbh.Text.Trim().Replace("'", "") != null && ddbh.Text.Trim().Replace("'", "") != "")
  254. {
  255. sql += "and tid like'" + ddbh.Text.Trim().Replace("'", "") + "'";
  256. }
  257. if (this.txtzdrq1.Text != "" && this.txtzdrq2.Text != "")
  258. {
  259. sql += "and pay_time between '" + txtzdrq1.Text.Trim() + "' and '" + txtzdrq2.Text.Trim() + "'";
  260. }
  261. else
  262. {
  263. sql += "order by modified desc";
  264. }
  265. DataTable dt = IFACE.DBUtility.DbHelperSQL.QueryDT(sql);
  266. if (dt != null && dt.Rows.Count > 0)
  267. {
  268. CardID.DataSource = dt;
  269. CardID.DataBind();
  270. }
  271. }
  272. //下面的查询按钮验证选择的日期框和查询所有的文本框里面输入的信息
  273. protected void Button1_Click(object sender, EventArgs e)
  274. {
  275. if (txtzdrq1.Text == "*")
  276. {
  277. txtzdrq1.Text = "";
  278. }
  279. if (txtzdrq2.Text == "*")
  280. {
  281. txtzdrq2.Text = "";
  282. }
  283. if (txtzdrq1.Text != "")
  284. {
  285. if (Convert.ToDateTime(txtzdrq1.Text) > DateTime.Now)
  286. {
  287. Response.Write("<script>alert('开始日期不能大于当前日期')</script>");
  288. return;
  289. }
  290. }
  291. if (txtzdrq2.Text != "" && txtzdrq2.Text != "")
  292. {
  293. if (Convert.ToDateTime(txtzdrq1.Text) > Convert.ToDateTime(txtzdrq2.Text))
  294. {
  295. Response.Write("<script>alert('开始日期不能大于结束日期')</script>");
  296. return;
  297. }
  298. }
  299. Button2.Enabled = true;
  300. bind();
  301. }
  302. //分页
  303. protected void CardID_PageIndexChanging(object sender, GridViewPageEventArgs e)
  304. {
  305. CardID.PageIndex = e.NewPageIndex;
  306. bind();
  307. }
  308. //是否上传身份证的状态检测
  309. protected void CardID_RowDataBound(object sender, GridViewRowEventArgs e)
  310. {
  311. #region 在控件里面显示的已上传,未上传,未检测
  312. Label lblIsload = (Label)e.Row.FindControl("lblIsload");//是否上传
  313. if (e.Row.RowType == DataControlRowType.DataRow)
  314. {
  315. if (lblIsload.Text.Trim().ToString().ToLower() == "true")
  316. {
  317. lblIsload.Text = "是";
  318. }
  319. else if (lblIsload.Text.Trim().ToString().ToLower() == "")
  320. {
  321. lblIsload.Text = "未检测";
  322. lblIsload.ForeColor = System.Drawing.Color.Red;
  323. }
  324. else
  325. {
  326. lblIsload.Text = "否";
  327. lblIsload.ForeColor = System.Drawing.Color.Red;
  328. }
  329. //if (e.Row.Cells[2].Text.ToString() == "True")
  330. //{
  331. // e.Row.Cells[2].Text = "是";
  332. //}
  333. //else if (e.Row.Cells[2].Text.ToString() == "False")
  334. //{
  335. // e.Row.Cells[2].Text = "否";
  336. //}
  337. //else if (e.Row.Cells[2].Text.ToString() != "False" || e.Row.Cells[1].Text.ToString() != "True")
  338. //{
  339. // e.Row.Cells[2].Text = "未检测";
  340. //}
  341. e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='SkyBlue'");
  342. e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c");
  343. }
  344. #endregion
  345. }
  346. //点击编辑将值传给panel1里面的每个对应的文本框
  347. //protected void CardID_RowEditing(object sender, GridViewEditEventArgs e)
  348. //{
  349. // Panel1.Visible = true;
  350. // btnSave.Enabled = true;
  351. // Button2.Enabled = false;
  352. // Panel2.Visible = false;
  353. // panel3.Visible = false;
  354. // //string lab = ((Label)CardID.Rows[e.NewEditIndex].Cells[3].FindControl("lblIsload")).Text;
  355. // //this.lblisload.Text = lab;
  356. // string isloadid = ((Label)CardID.Rows[e.NewEditIndex].Cells[3].FindControl("lblisloadID")).Text;
  357. // switch (isloadid)
  358. // {
  359. // case "True":
  360. // RadioButton1.Checked = true;
  361. // break;
  362. // case "False":
  363. // RadioButton2.Checked = true;
  364. // break;
  365. // default:
  366. // RadioButton3.Checked = true;
  367. // break;
  368. // }
  369. // this.lblshr.Text = this.CardID.Rows[e.NewEditIndex].Cells[4].Text;
  370. // this.lblmjzh.Text = this.CardID.Rows[e.NewEditIndex].Cells[5].Text;
  371. // this.lblwddm.Text = this.CardID.Rows[e.NewEditIndex].Cells[6].Text;
  372. // this.lblddh.Text = this.CardID.Rows[e.NewEditIndex].Cells[7].Text;
  373. // this.lblfksj.Text = this.CardID.Rows[e.NewEditIndex].Cells[8].Text;
  374. // this.lblxdsj.Text = this.CardID.Rows[e.NewEditIndex].Cells[9].Text;
  375. //}
  376. //保存修改的数据
  377. protected void btnSave_Click(object sender, EventArgs e)
  378. {
  379. string a = this.RadioButton1.Checked == true ? "1" : this.RadioButton2.Checked == true ? "0" : this.RadioButton3.Checked == true ? "null" : "";
  380. if (a != string.Empty)
  381. {
  382. string sql = @"update tbtrade set isload=" + a + " where tid='" + this.lblddh.Text + "'";
  383. int rows = IFACE.DBUtility.DbHelperSQL.ExecuteSql(sql);
  384. if (rows > 0)
  385. {
  386. Response.Write("<script>alert('修改成功!')</script>");
  387. btnQuery_Click(null, null);
  388. }
  389. else
  390. {
  391. Response.Write("<script>alert('修改失败!')</script>");
  392. }
  393. }
  394. }
  395. //全选checkbox事件
  396. protected void chkAll_CheckedChanged(object sender, EventArgs e)
  397. {
  398. for (int i = 0; i < this.CardID.Rows.Count; i++)
  399. {
  400. ((CheckBox)CardID.Rows[i].FindControl("chkItem")).Checked =
  401. ((CheckBox)this.CardID.HeaderRow.FindControl("chkAll")).Checked;
  402. }
  403. }
  404. //验证身份证是否上传
  405. protected void Button2_Click(object sender, EventArgs e)
  406. {
  407. #region 选择checkbox验证身份证是否上传的状态
  408. for (int i = 0; i < this.CardID.Rows.Count; i++)
  409. {
  410. CheckBox cb = ((CheckBox)CardID.Rows[i].FindControl("chkItem")) as CheckBox;
  411. string tid = this.CardID.DataKeys[i].Value.ToString();//在datakeyname属性里面设置了tid
  412. if (cb != null && cb.Checked)
  413. {
  414. DataTable dt = DbHelperSQL.QueryDT("select isLoad,receiver_name from tbtrade where tid='" + tid + "'");
  415. if (dt.Rows.Count > 0)
  416. {
  417. try
  418. {
  419. HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create("http://qingguanid.com/api/search.php?n=" + dt.Rows[0]["receiver_name"].ToString());
  420. HttpWebResponse response = (HttpWebResponse)request.GetResponse();
  421. System.Text.Encoding encoding = System.Text.Encoding.GetEncoding("gb2312");
  422. System.IO.StreamReader reader = new System.IO.StreamReader(response.GetResponseStream(), encoding);
  423. string htmlstr = reader.ReadToEnd();
  424. reader.Close();
  425. response.Close();
  426. int isload = 0;
  427. if (htmlstr.Contains("not found"))
  428. {
  429. isload = 0;
  430. }
  431. else
  432. {
  433. if (htmlstr.IndexOf(": confirmed") > -1)
  434. {
  435. isload = 1;
  436. }
  437. else
  438. {
  439. isload = 0;
  440. }
  441. }
  442. string sql = @"update tbtrade set isload=" + isload + " where tid='" + tid + "'";
  443. DbHelperSQL.ExecuteSql(sql);
  444. }
  445. catch (Exception error)
  446. {
  447. Response.Write(error.ToString());
  448. }
  449. }
  450. }
  451. }
  452. bind();
  453. #endregion
  454. }
  455. //传值给panel1里面对应的label控件
  456. protected void CardID_RowCommand(object sender, GridViewCommandEventArgs e)
  457. {
  458. if (e.CommandName == "tid")
  459. {
  460. GridViewRow drv = ((GridViewRow)(((LinkButton)(e.CommandSource)).Parent.Parent)); //此得出的值是表示那行被选中的索引值
  461. string tid = CardID.DataKeys[drv.RowIndex].Value.ToString(); //此获取的值为GridView中绑定数据库中的唯一标识
  462. Panel1.Visible = true;
  463. btnSave.Enabled = true;
  464. Button2.Enabled = false;
  465. Panel2.Visible = false;
  466. panel3.Visible = false;
  467. string isloadid = ((Label)CardID.Rows[drv.RowIndex].Cells[3].FindControl("lblisloadID")).Text;
  468. switch (isloadid)
  469. {
  470. case "True":
  471. RadioButton1.Checked = true;
  472. break;
  473. case "False":
  474. RadioButton2.Checked = true;
  475. break;
  476. default:
  477. RadioButton3.Checked = true;
  478. break;
  479. }
  480. this.lblshr.Text = this.CardID.Rows[drv.RowIndex].Cells[4].Text;
  481. this.lblmjzh.Text = this.CardID.Rows[drv.RowIndex].Cells[5].Text;
  482. this.lblwddm.Text = this.CardID.Rows[drv.RowIndex].Cells[6].Text;
  483. this.lblddh.Text = this.CardID.Rows[drv.RowIndex].Cells[7].Text;
  484. this.lblfksj.Text = this.CardID.Rows[drv.RowIndex].Cells[8].Text;
  485. this.lblxdsj.Text = this.CardID.Rows[drv.RowIndex].Cells[9].Text;
  486. }
  487. }
  488. }
  489.  

你可能感兴趣的:(在asp.net webform中的 gridview 里面的一些基本操作)