Can't debug button on gridview in UserControl

gedyExcudge

New Member
UserControlHtml in UserControl file which contain GridView,Inside Gridview which was store a button with event on it:\[code\]<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="WebUserControl1.ascx.cs" Inherits="WebApplication1.WebUserControl1" %><script type="text/javascript"></script><asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" > <Columns> <asp:TemplateField> <ItemStyle HorizontalAlign="Center" /> <HeaderStyle HorizontalAlign="Center" /> <ItemTemplate> <asp:Button ID="btnSelectC" CommandName="btnSelectC" runat="server" Text="Select" OnClick="selectedIndexChanging" /> </ItemTemplate> </asp:TemplateField> <asp:BoundField HeaderText="Price" DataField="Price" ItemStyle-CssClass="selectorClass"> <ItemStyle CssClass="selectorClass"></ItemStyle> </asp:BoundField> </Columns></asp:GridView>\[/code\]Codebehind in Usercontrol,Fill data for this UserControl,write a event when click button\[code\]protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { var list = (new[]{new{ Price=300}, new{ Price=400}, new{ Price=500}, new{ Price=600}, new{ Price=700}, new{ Price=800}}).ToList(); GridView1.DataSource = list; GridView1.DataBind(); } } protected void selectedIndexChanging(object sender, EventArgs e) { int i = 0; }\[/code\]Aspx pageHtml which contain a placeholder\[code\]<body> <form id="form1" runat="server"> <div> <asp:ScriptManager ID="sm" runat="server"></asp:ScriptManager> <asp:UpdatePanel ID="pnlResult" UpdateMode="Conditional" runat="server"> <ContentTemplate> <asp:PlaceHolder ID="phDV" runat="server" > </asp:PlaceHolder> </ContentTemplate> </asp:UpdatePanel> </div> </form></body>\[/code\]codebehind : Fill Usercontrol to placeholder\[code\]protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { WebUserControl1 uc = new WebUserControl1(); uc = (WebUserControl1)LoadControl("WebUserControl1.ascx"); uc.ID = "uc1"; phDV.Controls.Add(uc); LiteralControl dvDevices2End = new LiteralControl("</div>");//dvDevices2 phDV.Controls.Add(dvDevices2End); } }\[/code\]When Press SelectC button,It didn't show debug at UserControl.I don't know why?Thanks for any helping.
 
Back
Top