Skip to main content

Posts

Showing posts from June 2, 2010

Gridview headertemplate with checkbox and client side ( javascript) handling of select all / unselect all

Gridview headertemplate with checkbox and client side handling of select all / unselect all using javascript. courtesy from http://dotnetslackers.com/Community/blogs/kaushalparik/archive/2008/07/16/checkbox-in-headertemplate-to-select-all-checkboxes-inside-a-gridview-using-javascript.aspx Idea and code from this site, I enhached and made small corrections this for my application, according to my requirement Thanks to http://dotnetslackers.com/ for all the code.         <div>         <input type="hidden" id="hdnCheckBoxValue" />             <table>                 <tr>                     <td style="width: 100px;">                         <asp:GridView ID="gvVendorBulletin">                             <Columns>                                 <asp:TemplateField ItemStyle-HorizontalAlign="Center" ItemStyle-VerticalAlign="Middle"                            

Dynamically add CommandField of type Image to a gridview or any container.

Dynamically add CommandField of type Image to a grid or any container. if (!IsPostBack) { CommandField ImageCommand = new CommandField(); ImageCommand.ButtonType = ButtonType.Image; ImageCommand.DeleteImageUrl = "~/images/delete.gif"; ImageCommand.ShowCancelButton = false; ImageCommand.ShowDeleteButton = true; GridView1.Columns.Add(ImageCommand); } Then do the normal protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { } to delete or change as per your requirements.