Webboy2008
asked on
asp.net, c#, dynamic users controls
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Testing.aspx.cs" Inherits="Testing" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Register TagPrefix="obout" Namespace="Obout.ComboBox" Assembly="obout_ComboBox" %>
<%@ Register assembly="obout_Interface" namespace="Obout.Interface" tagprefix="cc1" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>How many city do you want to be listed:
<asp:DropDownList ID="Ddl_City" runat="server">
<asp:ListItem Value="1" Text="1"></asp:ListItem>
<asp:ListItem Value="2" Text="2"></asp:ListItem>
<asp:ListItem Value="3" Text="3"></asp:ListItem>
</asp:DropDownList>
<table>
<tr><td><div id="DivItemCode" runat="server"></div></td></tr>
</table>
</div>
<br />
<asp:Label ID="Label2" runat="server" Text=""></asp:Label>
<asp:Button ID="BtnSubmit" runat="server" Text="Submits" onclick="BtnSubmit_Click" />
</form>
</body>
</html>
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class Testing : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void TotalCount_SelectedIndexChanged(object sender, EventArgs e)
{
int TotalCountCity = int.Parse(Ddl_City.SelectedValue);
for (int i = 0; i < TotalCountCity; i++)
{
// list textboxes like <asp:TextBox name="txtCity_" & i & "><br>"
}
}
protected void BtnSubmit_Click(object sender, EventArgs e)
{
//if it is clicked, capture the value back and save into the database.
}
}
On the code back, I just try to catch the value and save into the database.
how can i do that?
500 points for working codes.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.