Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Buttons in header of grid

Status
Not open for further replies.

sheykc

Programmer
Sep 28, 2001
79
US
Is there a way to create a button in the header of a grid? My users want to click this button and have all the checkboxes below it either check or uncheck, like it did in their old system which used tables.

Thanks.

 
Yes you have to create the column as a template column. Then edit the template and add the button to the HeaderTemplate column.
 
Cool.. I was wondering if that would work.

Thanks!
 
Can you use normal code behind for this button? MIne doesn't appear to be firing at all.

This is the code in html:

Code:
<asp:TemplateColumn HeaderText="Delete">
<HeaderStyle CssClass="tdheader"></HeaderStyle>
<HeaderTemplate>
asp:Button ID="btnDelete" Runat="server" Text="Delete"></asp:Button>
</HeaderTemplate>
<ItemTemplate>
<asp:CheckBox ID="chkDelete" Checked='<%#DataBinder.Eval(Container, "DataItem.DeleteItemFlag")%>' Runat="server" OnCheckedChanged="Delete_Clicked" autopostback="True">
</asp:CheckBox>
</ItemTemplate>
</asp:TemplateColumn>

Trying to call this in the code behind:

Code:
Private Sub btnDelete_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnDelete.Click

End Sub
 
That's pretty close to what I did. I just call a method in the onclick.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top