隐藏GridView中的特定行链接

隐藏GridView中的特定行链接

本文介绍了隐藏GridView中的特定行链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我是一个网格视图,如果特定用户的余额是零,我显示了用户的余额,那么我必须禁用分期付款链​​接。这是我的代码...它不适用于特定的

这是关于

GridView RowDatabound EVENT

Hi,
I ahve an gridview where i am displaying a balance amount of the users if the balance amount of the specific users is ZERO then i have to disable the installment link.Here is my code...It is not working for specific
this is on
GridView RowDatabound EVENT

Label lblInstallments = ((Label)e.Row.FindControl("lblInstallments"));

        dt = m.fillplanmapping();

        if (dt.Rows.Count > 0)

        {



            for (int i = 0; i < dt.Rows.Count; i++)

            {

                int amt = Convert.ToInt32(dt.Rows["balanceamount"].ToString());

                if (amt > 0)

                {

                    lblInstallments.Visible = true;

                }

                else

                {

                    lblInstallments.Visible = false;

                }

            }

        }



错误:我收到所有链接对于第3行和第3行,我的余额为ZERO的行4如何解决这个问题...任何解决方案......


Error: I am getting links to all the rows where i have a balanceamount as ZERO for row 3 & 4 how to ge this...any soln...

推荐答案

<asp:GridView ID="GridView1" runat="server" DataKeyNames="id"

             AutoGenerateColumns="False" AllowPagig="True"  HeaderStyle-BackColor="#FFAA2B" HeaderStyle-ForeColor="White" RowStyle-BackColor="#FFE8C4" AlternatingRowStyle-BackColor="#FFD393"

             onpageindexchanging="GridView1_PageIndexChanging"  GridLines=Horizontal

             CellPadding="6" CellSpacing="3" onrowdeleting="GridView1_RowDeleting"

             onrowdatabound="GridView1_RowDataBound" AllowPaging="True"

              PageSize="50"

             >
             <Columns>

                <asp:BoundField HeaderText="CustomerID" DataField="customerid"

                     ItemStyle-HorizontalAlign="Center" ItemStyle-Width="100"  >


                 </asp:BoundField>

          <asp:BoundField HeaderText="Plan Name" DataField="planname"

                     ItemStyle-HorizontalAlign="Center" ItemStyle-Width="250"  >


                 </asp:BoundField>
                   <asp:BoundField HeaderText="Plan Price (In Rs.)" DataField="planprice"

                     ItemStyle-HorizontalAlign="Center" ItemStyle-Width="150"  >


                 </asp:BoundField>
                 <asp:BoundField HeaderText="Balance Amount (In Rs.)" DataField="balanceamount"

                     ItemStyle-HorizontalAlign="Center" ItemStyle-Width="150"  >


                 </asp:BoundField>

                          <asp:BoundField HeaderText="Membership Date"

                     DataField="membershipdate" ItemStyle-HorizontalAlign="Center"

                     ItemStyle-Width="200"  >

                 </asp:BoundField>

                                      <asp:BoundField HeaderText="ReceiptNumber"

                     DataField="receiptno" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="350"

                >

                 </asp:BoundField>

         <asp:TemplateField ItemStyle-HorizontalAlign="Center" ItemStyle-Width="75" HeaderText="Installments">
         <ItemTemplate>
         <a href="planmapping.aspx?id=<%#Eval("id") %>">
         <asp:Label ID="lblInstallments" runat="server" Text="Add Installments"></asp:Label>
         </a>
         </ItemTemplate>
         </asp:TemplateField>
         <asp:TemplateField ItemStyle-HorizontalAlign="Center" ItemStyle-Width="75"  HeaderText="Edit"  >
             <ItemTemplate>
                  <a href="planmapping.aspx?id=<%# Eval("id") %>" >
                      <asp:Label ID="Label3" runat="server" Text="Edit"></asp:Label>
                  </a>
             </ItemTemplate>




         </asp:TemplateField>

            <asp:TemplateField ItemStyle-HorizontalAlign="Center" ItemStyle-Width="75"  HeaderText="View"  >
             <ItemTemplate>
                  <a href="viewplandetails.aspx?id=<%# Eval("id") %>" onclick="return hs.htmlExpand(this, { objectType: 'iframe' } )">
                      <asp:Label ID="Label4" runat="server" Text="View"></asp:Label>
                  </a>
             </ItemTemplate>



         </asp:TemplateField>


               <asp:TemplateField>
               <ItemTemplate>
               </ItemTemplate>
               </asp:TemplateField>
                <asp:CommandField ButtonType="Link" HeaderText="Delete"

                     ShowDeleteButton="True"  />
             </Columns>

         </asp:GridView>


这篇关于隐藏GridView中的特定行链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-18 17:16