Post back events not working after dynamically loading template

Discussion in 'ASP .Net Web Controls' started by James Meehan, Dec 11, 2003.

  1. James Meehan

    James Meehan Guest

    I am dynamically changing the edit item template for a datalist control
    by using the LoadTemplate method for an ascx file, but I cannot get the
    postback events to work for a button or a link button. If I set the
    command name property for the button, the datalist item command event is
    not triggered on a postback. If I set the procedure to execute on the
    click event, e.g. OnClick = "procedureA", the ascx will not load since
    the procedure cannot be found. If I tirgger the postback from a button
    on the footer template, then the original edit item template is loaded.
    Any ideas? The code loaded from the ascx file is as follows:

    <%@ Language = "C#" %>
    <TABLE id="tblEdit" cellSpacing="1" cellPadding="1" width="600"
    border="0">
    <TR>
    <TD width="100">
    <table>
    <tr>
    <td>User Name:</td>
    </tr>
    <tr>
    <td><asp:textbox id=txtUserName Text='<%#
    DataBinder.Eval(Container,"DataItem.Name") %>' runat="server">
    </asp:textbox></td>
    <td><asp:requiredfieldvalidator id="vldUserName" Text="*"
    ControlToValidate="txtUserName" ErrorMessage="User name is required"
    Runat="server"></asp:requiredfieldvalidator></td>
    </tr>
    </table>
    </TD>
    <TD width="100">
    <table>
    <tr>
    <td>Password:</td>
    </tr>
    <tr>
    <td><asp:textbox id=txtPassword Text='<%#
    DataBinder.Eval(Container,"DataItem.Password") %>' runat="server">
    </asp:textbox></td>
    <td><asp:requiredfieldvalidator id="vldPassword" Text="*"
    ControlToValidate="txtPassword" ErrorMessage="Password is required"
    Runat="server"></asp:requiredfieldvalidator></td>
    </tr>
    </table>
    </TD>
    <TD width="200">Email Address:
    <asp:textbox id=txtEmail Text='<%#
    DataBinder.Eval(Container,"DataItem.Email") %>' Runat="server"
    TextMode="SingleLine">
    </asp:textbox></TD>
    </TR>
    <TR>
    <TD width="100">
    <table>
    <tr>
    <td>Roles:</td>
    </tr>
    <tr>
    <td><asp:checkbox id="chkUser" Text="User"
    Runat="server"></asp:checkbox></td>
    </tr>
    <tr>
    <td><asp:checkbox id="chkAdmin" Text="Administrator"
    runat="server"></asp:checkbox></td>
    </tr>
    </table>
    </TD>
    <TD width="200"><asp:validationsummary id="vldSummary" Runat="server"
    Width="100%"></asp:validationsummary></TD>
    <TD align="right" width="200">
    <asp:linkbutton id="lnkUpdateItem" runat="server"
    CommandName="update">Update</asp:linkbutton>&nbsp;&nbsp;
    <asp:linkbutton id="lnkCancelItem" runat="server"
    CommandName="cancel">Cancel</asp:linkbutton>
    </TD>
    </TR>
    </TABLE>



    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
    James Meehan, Dec 11, 2003
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ivan K
    Replies:
    0
    Views:
    444
    Ivan K
    Apr 28, 2004
  2. guptha
    Replies:
    0
    Views:
    373
    guptha
    Aug 4, 2006
  3. =?Utf-8?B?V2ViQnVpbGRlcjQ1MQ==?=

    post back does not work after paste

    =?Utf-8?B?V2ViQnVpbGRlcjQ1MQ==?=, Aug 22, 2006, in forum: ASP .Net
    Replies:
    2
    Views:
    505
    =?Utf-8?B?V2ViQnVpbGRlcjQ1MQ==?=
    Aug 22, 2006
  4. =?Utf-8?B?Z29yaWxsYQ==?=
    Replies:
    1
    Views:
    765
    Masudur
    May 25, 2007
  5. SevDer
    Replies:
    2
    Views:
    1,298
    Walter Wang [MSFT]
    Nov 13, 2007
Loading...

Share This Page