日期:2014-05-17  浏览次数:20405 次

checkbox选中对应的管理那里超连接失效.
<asp:GridView ID="gvOrderList" runat="server" HorizontalAlign =Center Width =100% DataKeyNames ="AdminID" AutoGenerateColumns =False PageSize="5" AllowPaging="True" OnPageIndexChanging="gvOrderList_PageIndexChanging" OnRowDeleting="gvOrderList_RowDeleting">
  <HeaderStyle Font-Bold =True />
  <Columns >
  <asp:TemplateField HeaderText ="单号">
  <HeaderStyle HorizontalAlign="Left"></HeaderStyle>
<ItemStyle HorizontalAlign="Left"></ItemStyle>
<ItemTemplate>
<%# DataBinder.Eval(Container.DataItem, "AdminID") %>
</ItemTemplate>  
  </asp:TemplateField>
  <asp:TemplateField HeaderText="">
  <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
<ItemStyle HorizontalAlign="Center" ></ItemStyle>
<ItemTemplate>
<a href='OrderModify.aspx?OrderID=<%# DataBinder.Eval(Container.DataItem, "AdminID") %>'>
管理</a>
  <ItemTemplate> 

   

</ItemTemplate> 
</ItemTemplate>  
  </asp:TemplateField>
  <asp:TemplateField HeaderText="选择">
  <ItemStyle HorizontalAlign="Center"/>
  <ItemTemplate>
  <asp:CheckBox ID="CheckBox" runat="server" ></asp:CheckBox>  
  </ItemTemplate>  
  </asp:TemplateField> 

  <asp:CommandField ShowDeleteButton="True" />
  </Columns>
  </asp:GridView>

  protected void Button1_Click(object sender, EventArgs e)
  {
  for (int i = 0; i < gvOrderList.Rows.Count; i++)
  {
  CheckBox cb

  = (CheckBox)gvOrderList.Rows[i].FindControl("CheckBox1");
  if (cb.Checked)
  {
   
   
  如何处理代码
  }
  }

 



  }
单击button 就是选中checkbox选中了对管理超链接失效....

------解决方案--------------------
C# code

foreach (GridViewRow row in GridView1.Rows)
{
    bool checked = ((CheckBox)row.FindControl("CheckBox1")).Checked;
    if (checked)
    {
       ((LinkButton)row.FindControl("LinkButton1")).Enable = false;
    }
}