How to create a custom control dynamically?

MarkH

New Member
Let me get this straight. I manage to create a custom \[code\]Gridview\[/code\] with a single \[code\]checkbox\[/code\] but my problem here is that I want to include multiple dynamic \[code\]Checkbox\[/code\]. Here is my code:\[code\]<%@ Control Language="C#" AutoEventWireup="true" EnableTheming="true" CodeFile="GridviewControl.ascx.cs" Inherits="UserControl_GridviewControl" %><link href="http://stackoverflow.com/questions/Template/CSS/Style.css"type="text/css" rel="Stylesheet" /><div> <span id="Span5" style="font-family: Arial; font-size:12px;" ><asp:Label ID="lblCount" runat="server" Text="0" Font-Bold="true"></asp:Label> Record/s</span> <span class="maintenance-btns"> <asp:Button ID="btnNew" runat="server" Text=" New " onclick="btnNew_Click"/> <asp:Button ID="btnDel" runat="server" Text=" Delete " onclick="btnDel_Click"/> </span></div><asp:Panel ID="pnlPc" runat="server" CssClass="div-grid" ScrollBars="Auto"> <asp:GridView ID="gvListing" runat="server" AllowPaging="True" AutoGenerateSelectButton="true" OnRowDataBound="gvListing_RowDataBound" skinid="gvListing" onselectedindexchanged="gvListing_SelectedIndexChanged" onpageindexchanging="gvListing_PageIndexChanging" PageSize="50" ><FooterStyle CssClass="grid-footer" /><Columns><asp:TemplateField HeaderText="CheckAll"><HeaderTemplate><asp:CheckBox ID="chkSelectAll" runat="server" AutoPostBack="true" OnCheckedChanged="chkSelectAll_CheckedChanged" CssClass="select-all"/></HeaderTemplate><ItemTemplate><asp:CheckBox ID="chkSelect" runat="server" AutoPostBack="true" OnCheckedChanged="chkSelect_CheckedChanged" CssClass="listing-checkbox"/></ItemTemplate></asp:TemplateField></Columns></asp:GridView></asp:Panel>\[/code\]In this \[code\]gridview\[/code\] I only have a \[code\]checkboxes\[/code\] at the first column. I want to put the dynamically generated \[code\]checkboxes\[/code\] at the last column.P.S.: How do I retrieve the id with those dynamically create \[code\]checkboxes\[/code\]?
 
Back
Top