开发者

Adding Controls dynamically. Asp.Net and VB

开发者 https://www.devze.com 2023-03-01 11:43 出处:网络
I\'m trying to add a \"panel\" with controls dynamicaly. Something like the code below, Clicking \"Add\" button, displays a \"Panel\" with the controls(which are within 开发者_如何学JAVAa table), the

I'm trying to add a "panel" with controls dynamicaly. Something like the code below, Clicking "Add" button, displays a "Panel" with the controls(which are within 开发者_如何学JAVAa table), the number of "Education" someone can enter is unlimited. I know how to capture the data, but i can't figure out how to implement/code this,Can anyone please give me some pointers for the same?

Should i be reading about AJAX? I don't know anything about AJAX..

<asp:Panel ID="Panel1" runat="server">
<table>
    <tr>
        <td><asp:TextBox ID="CollUniv_Name" runat="server"></asp:TextBox></td>
        <td><asp:TextBox ID="CollUniv_Location" runat="server"></asp:TextBox></td>
    </tr>

    <tr>
        <td><asp:TextBox ID="StartDateText" runat="server"></asp:TextBox></td>
        <td><asp:TextBox ID="EndDateText" runat="server"></asp:TextBox></td>

    </tr>
</table>


Seems like this would more naturally handled by a repeating control. Something along the lines of a ListView control.

There's a fairly full example in the MSDN page I linked to so I won't repeat it here. The two parts you'll want to take a look at a bit more closely are the ItemTemplate which lets you define what normal items look like and the InsertItemTemplate which lets you specify what your insert row will look like. You can also specify if the InsertTemplate appears at the top or bottom. In the code-behind you'll subscribe to the ItemInserting even and handle user input from there.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号