计算在gridview中选择或未选择的无记录 [英] count the no records are selected or un selected in gridview

查看:75
本文介绍了计算在gridview中选择或未选择的无记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何计算使用asp.net在gridview中选中/取消选中的复选框数量



i我在.aspx中使用此代码

< pre lang =xml> < asp:GridView ID = gridlob runat = server AutoGenerateColumns = False

DataSourceID = SqlDataSource2 width = 50%

onrowdatabound = gridlob_RowDataBound >
< >
< asp:BoundField DataField = LOUPe_LOB HeaderText = 业务线

SortExpression = LOUPe_LOB / >

< asp:TemplateField HeaderText = < span class =code-keyword>分组 >


< ItemTemplate
>
< asp: CheckBox ID = chkReimbursable runat = server / >
< / ItemTemplate >
< / asp:TemplateField >

< / Columns >
< / asp:GridView >



我在这样的代码中编写代码

 DataRowView drview = e.Row.DataItem  as  DataRowView; 
if (e.Row.RowType == DataControlRowType.DataRow)
{

CheckBox check =(CheckBox) e.Row.FindControl( chkReimbursable);

if (drview [ 1 ]。ToString()== Y
{
check.Checked = ;


}

else {
check.Checked = ;



}



我的要求是,如果用户在选择了他正在尝试的19条记录后有机会获得最多19条记录要选择另一个记录,其余复选框将被禁用。并且用户每次选择复选框都会选择记录的数量,并且未选择任何记录

解决方案

访问此处......... .... \



http://stackoverflow.com/questions/13254388/count-the-checked-checkboxes-in-gridview [ ^ ]


How to count number of checkboxes checked/unchecked in gridview using asp.net

i am using this code in .aspx

<asp:GridView ID="gridlob" runat="server" AutoGenerateColumns="False"

        DataSourceID="SqlDataSource2" width="50%"

          onrowdatabound="gridlob_RowDataBound" >
        <Columns>
            <asp:BoundField DataField="LOUPe_LOB" HeaderText="Line Of Bussiness"

                SortExpression="LOUPe_LOB" />

               <asp:TemplateField HeaderText="Grouping">


              <ItemTemplate>
                <asp:CheckBox ID="chkReimbursable" runat="server" />
                </ItemTemplate>
                </asp:TemplateField>

        </Columns>
    </asp:GridView>


and i write code in code behind like this

DataRowView drview = e.Row.DataItem as DataRowView;
if (e.Row.RowType == DataControlRowType.DataRow)
{

    CheckBox check = (CheckBox)e.Row.FindControl("chkReimbursable");
    
        if (drview[1].ToString() == "Y")
        {
            check.Checked = true;
            

        }

      else {
            check.Checked = false;

            
        
        }


My requirement if user have a chance to maximum 19 records after selecting 19 records he is trying to select another record the remaining checkboxes are disabled. and user select the checkbox each and every time count the no of records are selected and no of records are unselected

解决方案

visit here.............\

http://stackoverflow.com/questions/13254388/count-the-checked-checkboxes-in-gridview[^]


这篇关于计算在gridview中选择或未选择的无记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆