Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Post back events not working after dynamically loading template

Reply
Thread Tools

Post back events not working after dynamically loading template

 
 
James Meehan
Guest
Posts: n/a
 
      12-11-2003
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!
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
dynamically adding controls with events (but events are not firing) SevDer ASP .Net 2 11-13-2007 06:33 AM
How does a dynamic control load post back data across post back?? =?Utf-8?B?Z29yaWxsYQ==?= ASP .Net 1 05-25-2007 05:02 AM
Unable to get dynamically created controls after post back guptha ASP .Net 0 08-04-2006 02:50 PM
Dynamically adding onmouseover, onmouseout events not working Steve Macleod Javascript 2 05-20-2006 07:01 PM
Events Events Events Please Help Chris ASP .Net Web Controls 0 08-30-2005 08:21 PM



Advertisments