c# - ASP.NET: Custom Control Reloads Whole Page -


I am working with the C # code on an asp.net site. Now when I start creating a custom control program, the problem starts, I display control in a panel, but when I click on one of the control buttons, it does nothing if I click them twice I lose the user control, using the debugger, I found out that it is doing a postback, which is strange because I use the buttons and the user Asked experimenter made to false try to set; It's still sending postbacks. Here is where default.aspx file

  & asp: UpdatePanel runat = "server" id = "contentholder update panel" update.mode = "Conditional" & gt; & Lt; ContentTemplate & gt; & Lt; ASP: Panel Run = "Server" ID = "ContentPanel" & gt; & Lt; / ASP: Cell & gt; & Lt; / ContentTemplate & gt; & Lt; / ASP: UpdatePanel & gt;  

Here is the ASPX from ListadoAuditoria of Control

  & lt; Asp: UpdatePanel runat = "server" id = "auditorTableUpdatePanel" UpdateMode = "Conditional" & gt; & Lt; ContentTemplate & gt; & Lt; ASP: Table Runat = "server" id = "auditable" borderwidth = "0" width = "100%" & gt; & Lt; Asp: TableHeaderRow horizontal align = "center" & gt; & Lt; Asp: TableHeaderCell & gt; Button & lt; / Asp: TableHeaderCell & gt; & Lt; / ASP: TableHeaderRow & gt; & Lt; / ASP: Tables & gt; & Lt; / ContentTemplate & gt; & Lt; / ASP: UpdatePanel & gt; & Lt; Asp: UpdatePanel runat = "server" id = "formHolderUpdatePanel" UpdateMode = "Conditional" & gt; & Lt; ContentTemplate & gt; & Lt; ASP: label runat = "server" id = "test labels" text = "bbbbbbbbbbbbb" & gt; & Lt; / ASP: Labels & gt; & Lt; / ContentTemplate & gt; & Lt; / ASP: UpdatePanel & gt;  

The buttons have said, he should change the text label "code"> Test Labels from "Bbbbbbbbbbbbb" from "Aaaaaaaaa". Obviously I am doing auditorTableUpdatePanel.Update () after modifying the text.

Control CS

  Secure Zero Page_load (Object Sender, EventEurges e) {loadAudits (); } Public void Lodadio () (for (Int i = 0; i & lt; 10; ++ i) {Teblro row = new Teblro (); Table cell 1 = new Teblsel (); ImageButton deleteButton = new Imejbtn ( ); DeleteButton.ImageUrl = "~ / image.gif"; DeleteButton.Click + = generated NewPart; DeleteButton.EnableViewState = true; DeleteButton.ID = i.ToString (); cell1.Controls.Add (deleteButton); row.Cells KAdd (CELLl); AuditorTablekRowskAdd (line);}} public void Utpnnniprti (object sender, Iventaarjis e) {tumadre.Text = "aaaaaaaaaaaa"; formHolderUpdatePanel.Update ();}  

And when I generate control and it pays He puts the target, it is the code:

  Panel = (panel) Page.FindControl ( "contentPanel"); UpdatePanel updatePanel = (UpdatePanel) Page.FindControl ( "contentHolderUpdatePanel") ; Listdooditorias Listdooditorias = (Listdooditorias) Lodkantrol ( "~ / Krgduditoria / Listdooditoriaskascsh"); Panlkkantrolskaed (Listdooditorias); Updtepanelkapdet ();  

I looked at the internet and found nothing.

I'm not sure where the code is going to dynamically add control, but the controls To add it again, it should be called on each postback. You can not add it only once and forget about it. When you postback, the page will render with markup in your ASPX page (which is not your dynamic control, of course). Dynamically added values ​​will still be in the viewstate, but controls will not be re-presented.


Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -