create webcontrol at runtime

S

Simon Chuang

Hello,

This is a question about creating webcontrol at runtime.

I use a repeater to display "Name" and "Order". I hope that users can change
the "Order" field from the browser. And, if they input invalid value (such
as string) in the "Order" field, I hope the validator control can alert
them. Can I do this with repeater? Or I should use other webcontrol?

Thanks,
Simon

----------------------------------------------------------------------------
-------
<asp:repeater id="repeater1" runat="server">
<HeaderTemplate>
<table>
<TR class="gridHead">
<TD nowrap>Name</TD>
<TD nowrap>Order</TD>
</TR>
</HeaderTemplate>
<ItemTemplate>
<TR class="gridItem" valign="top">
<TD<%# DataBinder.Eval(Container.DataItem, "Name") %></TD>
<TD>
<asp:textbox id="txtOrder" runat="server" value="<%#
DataBinder.Eval(Container.DataItem, "Order") %>" />
<asp:RequiredFieldValidator ID="valOrder" Runat="server"
ControlToValidate="txtOrder" ErrorMessage="Cannot be empty." />
</TD>
</TR>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
<asp:repeater>
<asp:Button ID="btnSubmit" Runat="server" Text="Submit" />
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top