Advertisement
Guest User

Untitled

a guest
Jan 7th, 2011
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.08 KB | None | 0 0
  1. <%@ Import Namespace="System.Collections"%>
  2. <%@ Import Namespace="System.Collections.Generic"%>
  3. <%@ Page Language="C#"%>
  4. <html>
  5. <head>
  6.     <style type="text/css">
  7.         body
  8.         {
  9.             font-family: Calibri;
  10.             font-size: 13px;
  11.         }
  12.     </style>
  13.     <script runat="server">
  14.         public void cmdSubmit_Click(object Sender, EventArgs e)
  15.         {
  16.             Dictionary<int, String> textValues = new Dictionary<int, String>();
  17.             foreach(RepeaterItem rptrItem in rptTest.Items)
  18.             {
  19.                 TextBox txtEntry = (rptrItem.FindControl("txtEntry") as TextBox);
  20.                 textValues.Add(rptrItem.ItemIndex, txtEntry.Text);
  21.             }
  22.             textValues.Add(textValues.Count, "");
  23.             rptTest.DataSource = textValues;
  24.             rptTest.DataBind();
  25.         }
  26.     </script>
  27. </head>
  28. <body>
  29.     <form runat="server">
  30.         <asp:Repeater id="rptTest" runat="server">
  31.             <ItemTemplate>
  32.                 <div>
  33.                     Enter Value Here: <asp:TextBox ID="txtEntry" runat="server" Text='<%# Eval("Value") %>'></asp:TextBox>
  34.                 </div>
  35.             </ItemTemplate>
  36.         </asp:Repeater>
  37.         <asp:Button id="cmdSubmit" runat="server" Text="Add Textbox" OnClick="cmdSubmit_Click"/>
  38.     </form>
  39. </body>
  40. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement