I am making a menu for a cafe. It shows the food and rinks items, the price and then I want a textbox, where people can write how much of each they want to buy, shown in a textbox. Then I want each textbox to have a unique ID based on the menu items ID.
This is my repeater:
<asp:Repeater ID="ParentRepeater" runat="server" OnItemDataBound="ParentRepeater_ItemDataBound">
<ItemTemplate>
<h2>
<%#DataBinder.Eval(Container.DataItem, "typenavn") %></h2>
<asp:HiddenField ID="HiddenField1" Value='<%# Eval("id") %>' runat="server" />
<asp:Repeater ID="ChildRepeater" runat="server">
<ItemTemplate>
<table>
<tr>
<td style="width: 400px">
<%#DataBinder.Eval(Container.DataItem, "productName") %>
</td>
<td style="width: 400px">
<%#DataBinder.Eval(Container.DataItem, "pris") %>
</td>
<td>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</td>
</tr>
</table>
</ItemTemplate>
</asp:Repeater>
</ItemTemplate>
</asp:Repeater>
And this is my code behind:
protected void ParentRepeater_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
RepeaterItem item = e.Item;
if (item.ItemType == ListItemType.Item || item.ItemType == ListItemType.AlternatingItem)
{
Repeater ChildRepeater = (Repeater)item.FindControl("ChildRepeater");
HiddenField hide = e.Item.FindControl("HiddenField1") as HiddenField;
int id = Convert.ToInt32(hide.Value);
var query = from es in gr.products
where es.typeID == id
select es;
List<product> list = new List<product>();
foreach (product pro in query)
{
list.Add(pro);
}
ChildRepeater.DataSource = list;
ChildRepeater.DataBind();
int h = 0;
foreach (RepeaterItem item1 in ChildRepeater.Items)
{
if (item1.ItemType == ListItemType.Item || item1.ItemType == ListItemType.AlternatingItem)
{
TextBox txt = (TextBox)item1.FindControl("TextBox1") as TextBox;
HiddenField hf = (HiddenField)item1.FindControl("HiddenField2") as HiddenField;
for (int i = 0; i < list.Count; i++)
{
txt.ID = "HB" + list[h].id.ToString();
hf.Value = list[h].id.ToString();
h++;
break;
}
}
}
}
}
Anybody got any ideas about how to find the textbox??
You have to search for the TextBox in the RepeaterItem. So you either handle the inner Repeater's ItemDataBound event or you simply iterate all RepeaterItems:
foreach(RepeaterItem item in ChildRepeater.Items){
if(item.ItemType == ListItemType.Item || item.ItemType == ListItemType.AlternatingItem){
var txt = (TextBox)item.FindControl("TextBox1");
}
}
Related
I need to set 3 different groups of radio button in a repeater. Using groupname property for it wasn't enough. So, after researching, I use a bit of JS and it works. My problem is when I want to implement more than one group of radiobuttons. Can anyone help me?
My best approach is:
CSHTML
<asp:Repeater runat="server" ID="repeaterImages" OnItemDataBound="repeaterImages_ItemDataBound">
<ItemTemplate>
<span>
<asp:RadioButton runat="server" ID="rbLogoSeleccionado" Text='Logo 0' GroupName="nombreLogo" /><br />
<asp:RadioButton runat="server" ID="rbLogoSeleccionadoApp" Text='Logo 1' GroupName="nombreLogoApp" /><br />
<asp:RadioButton runat="server" ID="rbLogoSeleccionadoAppBlanco" Text='Logo 2' GroupName="nombreLogoAppBlanco" />
</span>
</ItemTemplate>
</asp:Repeater>
JS
<script>
function SetUniqueRadioButton(nameregex, current) {
for (i = 0; i < document.forms[0].elements.length; i++) {
elm = document.forms[0].elements[i]
if (elm.type == 'radio') {
elm.checked = false;
}
}
current.checked = true;
}
</script>
CS
protected void repeaterImages_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
try
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
RadioButton rbLogoSeleccionado = (RadioButton)e.Item.FindControl("rbLogoSeleccionado");
RadioButton rbLogoSeleccionadoApp = (RadioButton)e.Item.FindControl("rbLogoSeleccionadoApp");
RadioButton rbLogoSeleccionadoAppBlanco = (RadioButton)e.Item.FindControl("rbLogoSeleccionadoAppBlanco");
string script = "SetUniqueRadioButton('repeaterImages.*nombreLogo',this)";
string scriptApp = "SetUniqueRadioButton('repeaterImages.*nombreLogoApp',this)";
string scriptAppBlanco = "SetUniqueRadioButton('repeaterImages.*nombreLogoAppBlanco',this)";
rbLogoSeleccionado.Attributes.Add("onclick", script);
rbLogoSeleccionadoApp.Attributes.Add("onclick", scriptApp);
rbLogoSeleccionadoAppBlanco.Attributes.Add("onclick", scriptAppBlanco);
}
}
catch (Exception ex)
{
PIPEvo.Log.Log.RegistrarError(ex);
throw;
}
}
With this code just getting 3 rows of radiobutton, sharing groupname behavior for all of them... (I want groupname behavior per row...)
Piece of cake. Prove how newie I am in JS. I am posting the solution because is a recurrent issue in asp programming and this bug is known. Beside I cant find the solution for some radio button.
JS.
<script>
function SetUniqueRadioButton(text, current) {
for (i = 0; i < document.forms[0].elements.length; i++) {
elm = document.forms[0].elements[i]
if ((elm.type == 'radio') && (elm.value == text)) {
elm.checked = false;
}
}
current.checked = true;
}
</script>
CS
protected void repeaterImages_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
try
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
RadioButton rbLogoSeleccionado = (RadioButton)e.Item.FindControl("rbLogoSeleccionado");
RadioButton rbLogoSeleccionadoApp = (RadioButton)e.Item.FindControl("rbLogoSeleccionadoApp");
RadioButton rbLogoSeleccionadoAppBlanco = (RadioButton)e.Item.FindControl("rbLogoSeleccionadoAppBlanco");
string script = "SetUniqueRadioButton('rbLogoSeleccionado',this)";
string scriptApp = "SetUniqueRadioButton('rbLogoSeleccionadoApp',this)";
string scriptAppBlanco = "SetUniqueRadioButton('rbLogoSeleccionadoAppBlanco',this)";
rbLogoSeleccionado.Attributes.Add("onclick", script);
rbLogoSeleccionadoApp.Attributes.Add("onclick", scriptApp);
rbLogoSeleccionadoAppBlanco.Attributes.Add("onclick", scriptAppBlanco);
}
}
catch (Exception ex)
{
PIPEvo.Log.Log.RegistrarError(ex);
throw;
}
}
CSHTML
<asp:Repeater runat="server" ID="repeaterImages" OnItemDataBound="repeaterImages_ItemDataBound">
<ItemTemplate>
<span>
<asp:RadioButton runat="server" ID="rbLogoSeleccionado" Text='Logo 0' GroupName="nombreLogo" /><br />
<asp:RadioButton runat="server" ID="rbLogoSeleccionadoApp" Text='Logo 1' GroupName="nombreLogoApp" /><br />
<asp:RadioButton runat="server" ID="rbLogoSeleccionadoAppBlanco" Text='Logo 2' GroupName="nombreLogoAppBlanco" />
</span>
</ItemTemplate>
</asp:Repeater>
I'm trying to get selected values from radio button list and check box list at asp.net, C#.
Here's my code.
aspx.cs
protected void Next_Click(object sender, EventArgs e)
{
var retList = new List<string>();
foreach (RepeaterItem item in questionRepeater.Items)
{
// Checking the item is a data item
if (item.ItemType == ListItemType.Item || item.ItemType == ListItemType.AlternatingItem)
{
var rdbList = item.FindControl("RadioButtonList1") as RadioButtonList;
// Get the selected value
if (rdbList != null)
{
retList.Add(rdbList.SelectedValue);
}
}
}
foreach (RepeaterItem item in questionRepeater.Items)
{
// Checking the item is a data item
if (item.ItemType == ListItemType.Item || item.ItemType == ListItemType.AlternatingItem)
{
var rdbList = item.FindControl("CheckBoxList1") as CheckBoxList;
// Get the selected value
if (rdbList != null)
{
retList.Add(rdbList.SelectedValue);
}
}
}
}
aspx
<asp:Repeater ID="questionRepeater" runat="server">
<ItemTemplate>
<div runat="server" visible='<%# (Eval("QUESTION_TYPE").ToString() ==
"0") %>'>
<table style="width:100%; table-layout: fixed;">
<asp:RadioButtonList id="RadioButtonList1" CellSpacing="50"
TextAlign="Left" runat="server"
DataSource='<%#GetChild(Container.DataItem,"ChoicesRelate") %>'
DataTextField="CHOICES_CONTENT" DataValueField="CHOICES_NO">
</asp:RadioButtonList>
</table>
</div>
<div runat="server" visible='<%# (Eval("QUESTION_TYPE").ToString() ==
"1") %>'>
<table style="width:100%; table-layout: fixed;">
<asp:CheckBoxList id="CheckBoxList1" CellSpacing="50" TextAlign="Left"
runat="server"DataSource='<%#GetChild(Container.DataItem,"ChoicesRelate")
%>' DataTextField="CHOICES_CONTENT" DataValueField="CHOICES_NO">
</asp:CheckBoxList>
</table>
</div>
<br />
</ItemTemplate>
</asp:Repeater>
I refered below Answser.
Get radio button list responses with data source asp.net
problem
I can't get all selected values(just one value) from check box list, while I can get all from radio button list..
What should I do?
Please help me..
you can try something like this:
using System.Linq
...
foreach (RepeaterItem item in questionRepeater.Items)
{
// Checking the item is a data item
if (item.ItemType == ListItemType.Item || item.ItemType == ListItemType.AlternatingItem)
{
var rdbList = item.FindControl("CheckBoxList1") as CheckBoxList;
// Get the selected value
if (rdbList != null)
{
//get selected items' values
List<string> selectedItems = rdbList.Items.Cast<ListItem>()
.Where(li => li.Selected)
.Select(li => li.Value)
.ToList();
//add to your list of strings
retList.AddRange(selectedItems);
}
}
}
or, in case you don't want to use Linq,
if (item.ItemType == ListItemType.Item || item.ItemType == ListItemType.AlternatingItem)
{
var rdbList = item.FindControl("CheckBoxList1") as CheckBoxList;
// Get the selected value
if (rdbList != null)
{
foreach (ListItem li in rdbList.Items)
{
if (li.Selected)
retList.Add(li.Value);
}
}
}
I have created dynamic radio button/check box controls with help of a repeater. But the controls are getting lost after postback.
as an example, if i check the radion button which is i create using the repeater all the radio buttons will disappear
here is my aspx code
<asp:Repeater ID="myRepeater" runat="server" OnItemCommand="myRepeater_ItemCommand" OnItemDataBound="myRepeater_ItemDataBound">
<HeaderTemplate>
<table>
<tr class="">
<td>
</td>
<td>
Name
</td>
<td>
Address
</td>
<td>
Age
</td>
<td>
Year
</td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td>
<asp:Panel ID="pnlSelect" runat="server" EnableViewState="true"></asp:Panel>
</td>
<td>
<%#Eval("Name")%>
</td>
<td>
<%#Eval("Address")%>
</td>
<td>
<%#Eval("Age")%>
</td>
<td>
<%# Eval("Year")%>
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
my .cs code
myRepeater.DataSource = *DataSource*;
myRepeater.DataBind();
protected void myRepeater_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
{
if (** condition 01 **)
{
if (** condition 02 **)
{
RadioButton rdoBtn = new RadioButton();
rdoBtn.ID = "rbtnID";
rdoBtn.EnableViewState = true;
rdoBtn.GroupName = "GroupName";
rdoBtn.AutoPostBack = true;
rdoBtn.CheckedChanged += new System.EventHandler(this.rdoBtnChecked_Changed);
string script = "SetUniqueRadioButton('myRepeater.*GroupName',this)";
rdoBtn.Attributes.Add("onclick", script);
Panel pnlRbtnSet = e.Item.FindControl("pnlSelect") as Panel;
pnlRbtnSet.Controls.Add(rdoBtn);
}
else
{
CheckBox chkBox = new CheckBox();
chkBox.ID = "chkBxID";
chkBox.Checked = true;
chkBox.EnableViewState = true;
Panel pnlChkBoxesSet = e.Item.FindControl("pnlSelect") as Panel;
pnlChkBoxesSet.Controls.Add(chkBox);
}
}
}
}
protected void rdoBtnChecked_Changed(Object sender, EventArgs e)
{
}
i have set enableViewState=true for both the drawing panel and each control which is creating dynamically. but it does not work. please help me...
If you need to create dynamic controls you have to recreate them on every postback. So ItemDataBound is inappropriate since it's only triggered when the repeater is getting databound. Use ItemCreated instead.
protected void myRepeater_ItemCreated(object sender, RepeaterItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
{
if (** condition 01 **)
{
if (** condition 02 **)
{
RadioButton rdoBtn = new RadioButton();
rdoBtn.ID = "rbtnID";
rdoBtn.EnableViewState = true;
rdoBtn.GroupName = "GroupName";
rdoBtn.AutoPostBack = true;
rdoBtn.CheckedChanged += new System.EventHandler(this.rdoBtnChecked_Changed);
string script = "SetUniqueRadioButton('myRepeater.*GroupName',this)";
rdoBtn.Attributes.Add("onclick", script);
Panel pnlRbtnSet = e.Item.FindControl("pnlSelect") as Panel;
pnlRbtnSet.Controls.Add(rdoBtn);
}
else
{
CheckBox chkBox = new CheckBox();
chkBox.ID = "chkBxID";
chkBox.Checked = true;
chkBox.EnableViewState = true;
Panel pnlChkBoxesSet = e.Item.FindControl("pnlSelect") as Panel;
pnlChkBoxesSet.Controls.Add(chkBox);
}
}
}
}
<asp:Repeater ID="Repeater1" runat="server" OnItemDataBound="Repeater1_ItemDataBound">
<ItemTemplate>
<tr>
<td><%#subtypes.FindByPk(Convert.ToInt32(Eval("SubitemID"))).title%></td>
<td><%#Eval("quantity")%></td>
<td><%#ThanaRecord.FindByPk(Convert.ToInt32(Eval("Thanaid"))).title%></td>
<td><%#Eval("created_at")%></td>
<td> <% if (Employee.GetCurrentEmployee().role == "Admin") { %>
EDIT
DELETE
<% } %>
<%if (Employee.GetCurrentEmployee().role == "SuperVisor")
{ %>
<asp:DropDownList ID="DropDownList1" runat="server" Width="120px" AutoPostBack="true" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged" CssClass="form-control">
<asp:ListItem Text="Status" Value="0">Status</asp:ListItem>
<asp:ListItem Text="Accept" Value="1">Accept</asp:ListItem>
<asp:ListItem Text="Reject" Value="2">Reject</asp:ListItem>
</asp:DropDownList>
<%--<asp:textbox runat="server" id="textTest"></asp:textbox>--%>
</td>
<%} %>
</tr>
</ItemTemplate>
</asp:Repeater>
Code:
protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
//DropDownList DropDownList1 = (DropDownList)sender;
//string SelectedValue = DropDownList1.SelectedValue;
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
DropDownList ddldrop = (DropDownList)e.Item.FindControl("DropDownList1");
int value =Convert.ToInt32( ddldrop.SelectedValue);
Supervisor sup = new Supervisor();
if (value ==1 ) {
sup.Status = "Accept";
sup.Save();
}
}
}
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
//Supervisor sup = new Supervisor();
//sup.Status = "Accept";
//sup.Save();
}
You just have to cast the sender argument in the event-handler to DropDownList. It is always the source of the event. So no need to use FindControl:
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
DropDownList ddl = (DropDownList) sender;
string selectedValue = ddl.SelectedValue;
// ...
}
I have a 2 Dropdownlist outside a repeater (1st ddl will trigger and refresh the content of the repeater, 2nd ddl refresh its list after an item inside the repeater were executed) and a dropdownlist control inside the repeater.i don't have a problem with the 1st dropdownlist but the 2nd dropdownlist when triggered via selectedindexchanged, it also fires up the selectedindexchanged of the dropdownlist inside the repeater. I put up an UpdatePanel on the repeater and on the 2nd dropdownlist but still the error occurs.
How can i trace the step by step execution and also why the selectedindexchanged handler fires up?
Here is the code snippet:
CODE BEHIND:
public partial class NewStyleItem : System.Web.UI.Page
{
protected StyleTemplateManager styleTempMngr = new StyleTemplateManager();
protected StyleFabricationManager styleFabMngr = new StyleFabricationManager();
protected List<ComponentReferenceView> ReferenceLookUpList
{
get
{
return (List<ComponentReferenceView>)ViewState["ReferenceLookUpView"];
}
set
{
ViewState["ReferenceLookUpView"] = value;
}
}
protected List<ComponentReferenceView> ReferenceViewList
{
get
{
return (List<ComponentReferenceView>)ViewState["CompReferenceView"];
}
set
{
ViewState["CompReferenceView"] = value;
}
}
protected void Page_Load(object sender, EventArgs e)
{
if (this.IsPostBack == false)
{
LoadBrandList();
ddlGarmentList.Enabled = false;
//ReferenceLookUpList = new List<ComponentReferenceView>();
}
else
{
}
//rptStyleComponents.DataSource = ReferenceLookUpList;
//rptStyleComponents.DataBind();
}
protected void LoadBrandList()
{
BrandManager brandMngr = new BrandManager();
ddlBrandList.Items.Clear();
ddlBrandList.Items.Add(new ListItem { Text = "Select brand", Value = "" });
foreach (Brand item in brandMngr.Brands())
{
ddlBrandList.Items.Add(new ListItem
{
Text = item.BrandDescription,
Value = item.BrandCode
});
}
}
protected void LoadComponentInfo(string BrandCode)
{
if (styleTempMngr.FindTemplateByBrandCode(BrandCode) == true)
{
ReferenceLookUpList = (from StyleComponent i in styleFabMngr.ComponentList
join StyleFabReference x in styleTempMngr.ReferenceList on
i.SectionCode equals x.SectionCode
select new ComponentReferenceView
{
InOrder = x.SortOrder,
IsNeeded = x.IsRequired,
SCode = x.SeriesCode,
SecCode = x.SectionCode,
SecName = i.SectionName,
EntryValue = x.DataCharacter
}).OrderBy(p => p.InOrder).ToList();
ReferenceLookUpList.Where(row => row.SecCode == "BCODE").ToList()
.ForEach(refItem => refItem.EntryValue = ddlBrandList.SelectedValue);
var DistinctList = (from StyleFabReference x in styleTempMngr.ReferenceList.OrderBy(p => p.SortOrder).ToList()
where x.SectionCode != "SPCHAR" && x.SectionCode != "BCODE"
select x.SectionCode).Distinct().ToList();
ReferenceViewList = (from StyleComponent i in styleFabMngr.ComponentList
join x in DistinctList on
i.SectionCode equals x
select new ComponentReferenceView
{
SecCode = x,
SecName = i.SectionName
}).OrderBy(p => p.InOrder).ToList();
}
else
ReferenceViewList = new List<ComponentReferenceView>();
rptStyleComponents.DataSource = ReferenceViewList;
rptStyleComponents.DataBind();
}
protected void LoadGarments(string ApparelCode)
{
if (string.IsNullOrEmpty(ddlBrandList.SelectedValue) == true)
{
ddlGarmentList.SelectedIndex = 0;
ddlGarmentList.Enabled = false;
}
else
{
ddlGarmentList.Enabled = true;
GarmentManager gmMngr = new GarmentManager();
List<Garment> garmentList = new List<Garment>();
garmentList = gmMngr.GetGarmentsByBrand(ddlBrandList.SelectedValue, ApparelCode);
ddlGarmentList.Items.Clear();
ddlGarmentList.Items.Add(new ListItem { Text = "Select garment", Value = "" });
foreach (Garment item in garmentList)
{
ddlGarmentList.Items.Add(new ListItem { Text = item.GarmentDescription, Value = item.GarmentCode });
}
}
}
protected void ddlBrandList_SelectedIndexChanged(object sender, EventArgs e)
{
txtNewStyleNo.Text = string.Empty;
if (string.IsNullOrEmpty(ddlBrandList.SelectedValue) == false)
LoadComponentInfo(ddlBrandList.SelectedValue);
}
[Serializable]
public class ComponentReferenceView
{
public string SCode
{
get;
set;
}
public string SecCode
{
get;
set;
}
public string SecName
{
get;
set;
}
public int InOrder
{
get;
set;
}
public bool IsNeeded
{
get;
set;
}
public string EntryValue
{
get;
set;
}
}
protected void rptStyleComponents_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
}
protected void rptStyleComponents_ItemCreated(object sender, RepeaterItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
DropDownList ddlControl = (DropDownList)e.Item.FindControl("ddlDataSelection");
if (ddlControl != null)
{
ddlControl.AppendDataBoundItems = true;
ddlControl.Items.Add(new ListItem { Text = "Select " + ReferenceViewList[e.Item.ItemIndex].SecName.ToLowerInvariant(), Value = "" });
var itemlist = (from x in styleFabMngr.ComponentRowItems(ReferenceViewList[e.Item.ItemIndex].SecCode).AsEnumerable()
select new ListItem
{
Text = x.Field<string>("col_name"),
Value = x.Field<string>("col_value")
});
ddlControl.Items.AddRange(itemlist.ToArray<ListItem>());
ddlControl.EnableViewState = false;
ddlControl.AutoPostBack = true;
ddlControl.SelectedIndexChanged += new EventHandler(DropDownListSelectedIndexChanged);
}
}
}
protected virtual void DropDownListSelectedIndexChanged(object sender, EventArgs e)
{
DropDownList ddl = (DropDownList)sender;
RepeaterItem item = (RepeaterItem)ddl.NamingContainer;
ReferenceViewList[item.ItemIndex].EntryValue = ddl.SelectedValue;
ConstructStyleNo();
var Apparelfound = ReferenceViewList.Where(x => x.SecCode == "APCODE" &&
string.IsNullOrEmpty(x.EntryValue) == false).FirstOrDefault();
if (Apparelfound != null)
{
ddlGarmentList.Enabled = true;
LoadGarments(Apparelfound.EntryValue);
}
else
{
ddlGarmentList.Enabled = false;
}
}
private void ConstructStyleNo()
{
foreach (ComponentReferenceView item in ReferenceViewList)
{
ReferenceLookUpList.Where(row => row.SecCode == item.SecCode).ToList()
.ForEach(refItem => refItem.EntryValue = item.EntryValue);
}
string sResult = string.Empty;
var result = (from x in ReferenceLookUpList.OrderBy(y => y.InOrder)
select x.EntryValue);
txtNewStyleNo.Text = string.Empty;
if (result != null)
txtNewStyleNo.Text = String.Join("", result) + "0001";
}
private void ConstructStyleDescription()
{
txtStyleDescription.Text = ddlBrandList.SelectedItem.Text + "-" + ddlGarmentList.SelectedItem.Text;
}
protected void ddlGarmentList_SelectedIndexChanged(object sender, EventArgs e)
{
txtStyleDescription.Text = string.Empty;
if (string.IsNullOrEmpty(ddlGarmentList.SelectedValue) == false)
ConstructStyleDescription();
}
}
ASPX:
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<asp:UpdatePanel ID="upnlNewFabrication" runat="server">
<ContentTemplate>
<h1>
New Style Item
</h1>
<br />
<%--<usrCtrl:style_generation ID="stylegen_frm" runat="server">
</usrCtrl:style_generation>--%>
<table>
<tr>
<td>
Brand :
</td>
<td>
<asp:DropDownList ID="ddlBrandList" runat="server"
onselectedindexchanged="ddlBrandList_SelectedIndexChanged"
AutoPostBack="True">
</asp:DropDownList>
</td>
</tr>
<tr>
<td colspan="2">
</td>
</tr>
<tr>
<td>
Generated Style# :
</td>
<td>
<asp:TextBox ID="txtNewStyleNo" runat="server" ReadOnly="true"></asp:TextBox>
</td>
</tr>
<tr>
<td>
Style Description :
</td>
<td>
<asp:TextBox ID="txtStyleDescription" runat="server" ReadOnly="true"></asp:TextBox>
</td>
</tr>
<asp:Repeater ID="rptStyleComponents" runat="server"
onitemdatabound="rptStyleComponents_ItemDataBound"
onitemcreated="rptStyleComponents_ItemCreated"
EnableViewState="True">
<ItemTemplate>
<asp:UpdatePanel ID="upnlComponent" runat="server">
<ContentTemplate>
<tr>
<td>
<asp:Label ID="lblSectionName" runat="server" Text='<%# Eval("SecName")%>' ></asp:Label>
</td>
<td>
<asp:DropDownList ID="ddlDataSelection" runat="server">
</asp:DropDownList>
</td>
</tr>
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="ddlDataSelection" />
</Triggers>
</asp:UpdatePanel>
</ItemTemplate>
</asp:Repeater>
</table>
<br />
<table>
<tr>
<td colspan="2">Description Items</td>
</tr>
<tr>
<td colspan="4"></td>
</tr>
<tr>
<td>Garment Type:</td>
<td>
<asp:UpdatePanel ID="upGarment" runat="server" >
<ContentTemplate>
<asp:DropDownList ID="ddlGarmentList" runat="server"
AppendDataBoundItems="True" AutoPostBack="True"
onselectedindexchanged="ddlGarmentList_SelectedIndexChanged">
<asp:ListItem Text = "Select garment" Value = ""></asp:ListItem>
</asp:DropDownList>
<asp:SqlDataSource ID="sdsGarment" runat="server"
ConnectionString="<%$ ConnectionStrings:IRMSConnectionString %>"
SelectCommand="Select * from Garments"></asp:SqlDataSource>
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="ddlGarmentList" />
</Triggers>
</asp:UpdatePanel>
</td>
</tr>
<tr>
<td>Cost Price:</td>
<td>
<asp:TextBox ID="txtCostPrice" runat="server"></asp:TextBox></td>
<td>SRP :</td>
<td><asp:TextBox ID="txtSRP" runat="server"></asp:TextBox></td>
</tr>
<tr>
<td>Quantity :</td>
<td><asp:TextBox ID="TextBox1" runat="server"></asp:TextBox></td>
<td>Week :</td>
<td><asp:TextBox ID="TextBox2" runat="server"></asp:TextBox></td>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Content>