日韩天天综合网_野战两个奶头被亲到高潮_亚洲日韩欧美精品综合_av女人天堂污污污_视频一区**字幕无弹窗_国产亚洲欧美小视频_国内性爱精品在线免费视频_国产一级电影在线播放_日韩欧美内地福利_亚洲一二三不卡片区

解析GridView中添加CheckBox并返回選中行_.Net教程

編輯Tag賺U幣
教程Tag:暫無(wú)Tag,歡迎添加,賺取U幣!

推薦:解析Asp.net動(dòng)態(tài)生成頁(yè)面控件的辦法
在Asp.net開(kāi)發(fā)中,有時(shí)需要在頁(yè)面中動(dòng)態(tài)添加控件。這些控件可以是普通的html標(biāo)簽,也可以是Asp.net獨(dú)有的服務(wù)器端控件。關(guān)于動(dòng)態(tài)寫(xiě)入html標(biāo)簽控件,大家都熟悉,這里就不再表述。本文討論的重點(diǎn)是:如何動(dòng)態(tài)寫(xiě)入服務(wù)器端控件,并且在頁(yè)面PostBack到Server端

一:添加CheckBox
<asp:GridView> 
     <Columns>
          <asp:TemplateField HeaderText="選擇">
          <ItemStyle HorizontalAlign="Center" Height="35px" Width="720px"/>
          <ItemTemplate>
          <asp:CheckBox ID="CheckBox" runat="server" ></asp:CheckBox>   
          </ItemTemplate>    
          </asp:TemplateField>
          <asp:BoundField DataField="Code" HeaderText="學(xué)號(hào)" SortExpression="Code">
              <ItemStyle HorizontalAlign="Center" Height="35px" Width="720px"/>
          </asp:BoundField>
          <asp:BoundField DataField="Name" HeaderText="姓名">
              <ItemStyle HorizontalAlign="Center" Height="35px" Width="720px"/>
          </asp:BoundField>
          <asp:BoundField DataField="SchoolName" HeaderText="所在學(xué)校">
              <ItemStyle HorizontalAlign="Center" Height="35px" Width="720px"/>
          </asp:BoundField>
          <asp:BoundField DataField="Email" HeaderText="E-mail">
              <ItemStyle HorizontalAlign="Center" Height="35px" Width="720px"/>
          </asp:BoundField>
     </Columns>
</asp:GridView> 
二:查看哪一行的CheckBox被選中
foreach(GridViewRow row in this.StudentGridView.Rows)
        {
            Control ctrl = row.FindControl("CheckBox"); 
                if ((ctrl as CheckBox).Checked)
                {
                    TableCellCollection cell = row.Cells;
                    string studentCode = cell[1].Text;
                 } 
         }

分享:Windows2003中配置運(yùn)行ASP.net程序
Windows2003系統(tǒng) 在默認(rèn)情況下沒(méi)有將IIS6.0安裝,并且當(dāng)最初安裝IIS6.0 時(shí),該服務(wù)在高度安全和鎖定模式下安裝。在這種默認(rèn)情況下,IIS6.0 只為靜態(tài)內(nèi)容提供服務(wù),而諸如 ASP 、 ASP.NET 、在服務(wù)器端的包含文件、WebDAV 發(fā)布和 FrontPage Server Extensio

來(lái)源:模板無(wú)憂(yōu)//所屬分類(lèi):.Net教程/更新時(shí)間:2010-04-24
相關(guān).Net教程