Populate Listview without DataSource/Table? - c#

Just for background: So Im trying to create an interface for users to check-in. The concept is simple:A Listview where each item holds an image, name, some info, and a button to the right that says check-in (That they'd press).
This interface is on a webpage (.aspx) with an .aspx.cs codefile.
I've created my ListView & set templates
<asp:ListView
ID="lvInstructors"
runat="server"
AutoGenerateColumns="False"
ShowRegularGridWhenEmpty="False"
EmptyDataText="No Sessions to Display."
OnRowDataBound="lvDataBound"
OnRowCommand="lvCommand"
Visible="true">
<LayoutTemplate>
<div class="container" id="mainContent">
<asp:PlaceHolder ID="itemPlaceHolder" runat="server" />
</div>
</LayoutTemplate>
<ItemTemplate>
<div class="row instructorItem">
<div class="col-2 sessionStartTimeDiv">
<p class="sessionStartTime"></p>
</div>
<div class="col-2 instructorHeadshotDiv">
<asp:Image class="instructorHeadshot" runat="server" src="" />
</div>
<div class="col-5 sessionInfoDiv">
<h3 class="instructorName"></h3>
<p class="sessionInfo"></p>
</div>
<div class="col-3 checkInBtnDiv">
<asp:Button class="checkInBtn" OnClick="CheckInBtn_Click" ID="checkInBtn" runat="server" Text="CHECK-IN" />
</div>
</div>
</ItemTemplate>
<EmptyDataTemplate>No Sessions to Display</EmptyDataTemplate>
</asp:ListView>
My issue is, I don't want to link this ListView to a database, source, or table (Is that even possible)
Below are the variables in .aspx.cs that I'd like to populate my ListView Items with, but Im not sure how to go about doing do, especially when it comes to creating a new ListView Item per each for loop. Any suggestions? Thanks Alot!
foreach (Session S in UpcomingSessions)
{
foreach(Enrollment I in S.Instructors())
{
SessionName = S.Name;
SessionStartTime = S.FirstDateTime().ToShortTimeString();
InstructorName = I.FirstName + " " + I.LastName;
SessionRoom = S.Room.ToString();
}
}

Try like this
public class Instructors{
public string SessionName{get;set;}
public DateTime SessionStartTime {get;set;}
public string InstructorName {get;set;}
public string SessionRoom {get;set;}
}
List<Instructors> InstructorsLst=new List<Instructors>();
foreach (Session S in UpcomingSessions)
{
foreach(Enrollment I in S.Instructors())
{
Instructors inst=new Instructors();
inst.SessionName = S.Name;
inst.SessionStartTime = S.FirstDateTime().ToShortTimeString();
inst.InstructorName = I.FirstName + " " + I.LastName;
inst.SessionRoom = S.Room.ToString();
InstructorsLst.Add(inst);
}
}
lvInstructors.DataSrouce = InstructorsLst;
lvInstructors.DataBind();

Related

Issue grabbing correct control/update panel in repeater

I'm having issues with dynamically updating a drop down list control when it is inside a repeater.
Basically I have a repeater and inside that repeater are 2 drop down lists. The one list is defined in my aspx page, the other drop down list is inside an update panel where I want to be able to have it dynamically update based on the selection of the first drop down list. I think part of my problem is the updatepanel is getting confused because I have more than one repeater item?
Here is the code for my repeater:
<asp:Repeater ID="billingTemplate" runat="server" OnItemDataBound="template_ItemDataBound">
<ItemTemplate>
<tr style="font-size: 100%" runat="server">
<td colspan="4" style="width: 100%; vertical-align: top">
<div class="panel panel-default panel-billing">
<asp:Panel CssClass="row panel-heading panel-heading-billing text-left" ID="headingBilling" ClientIDMode="Static" runat="server">
<div class="col-xs-1">
<input type="hidden" id="templateUK" runat="server" value='<%#Eval("templateUK")%>' />
</div>
<div class="col-sm-3">
<label for="ddlInvFilterType" class="col-sm-4 control-label text-right labelCls testclass">Filter Type:</label>
<div class="col-sm-8">
<asp:DropDownList runat="server" ID="ddlInvFilterType" ClientIDMode="Static" placeholder="Choose Filter Type" CssClass="form-control smallSize FilterType" AutoPostBack="true" OnSelectedIndexChanged="ddlFilterType_SelectedIndexChanged">
<asp:ListItem Value="">- None -</asp:ListItem>
<asp:ListItem Value="RevType1">Revenue Type 1</asp:ListItem>
<asp:ListItem Value="RevType2">Revenue Type 2</asp:ListItem>
<asp:ListItem Value="RevType3">Revenue Type 3</asp:ListItem>
<asp:ListItem Value="ServiceTeams">Service Team</asp:ListItem>
</asp:DropDownList>
</div>
</div>
<asp:UpdatePanel ID="InvFilterValuePanel" ClientIDMode="Static" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="false">
<ContentTemplate>
<div class="col-sm-3">
<label for="ddlInvFilterValue" class="col-sm-4 control-label text-right labelCls">Filter Value:</label>
<div class="col-sm-8">
<asp:DropDownList runat="server" ID="ddlInvFilterValue" ClientIDMode="Static" placeholder="Choose Filter Value" CssClass="col-sm-6 form-control smallSize">
<asp:ListItem Value="">- None -</asp:ListItem>
</asp:DropDownList>
</div>
</div>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="ddlInvFilterType" EventName="SelectedIndexChanged" />
</Triggers>
</asp:UpdatePanel>
</asp:Panel>
<asp:Panel CssClass="panel-collapse collapse" ID="collapseBilling" ClientIDMode="Static" runat="server">
<div class="panel-body">
<table class="table table-condensed table-bordered" style="margin: 0; padding: 0; border-top: none; border-bottom: none; border-left: thin; border-right: thin">
<tbody>
<%-- other controls --%>
</tbody>
</table>
</div>
</asp:Panel>
</div>
</td>
</tr>
</ItemTemplate>
</asp:Repeater>
Heres the code for my selected index change:
protected void ddlFilterType_SelectedIndexChanged(object sender, EventArgs e)
{
try
{
DropDownList ddl = (DropDownList)sender;
string ddlClass = ddl.CssClass;
string[] classes = ddlClass.Split(' ');
string repeaterClass = classes[classes.Length - 1];
string repeaterID = "0";
string appendStr = "";
if (repeaterClass.Contains("templateID"))
{
repeaterID = repeaterClass.Substring(repeaterClass.Length - 1);
appendStr = "_" + repeaterID;
}
foreach (RepeaterItem item in billingTemplate.Items)
{
HtmlInputHidden hidden = item.FindControl("headingBilling").FindControl("templateUK") as HtmlInputHidden;
if (hidden.Value == repeaterID)
{
DropDownList d1 = item.FindControl("headingBilling").FindControl("ddlInvFilterType") as DropDownList;
DropDownList d2 = item.FindControl("headingBilling").FindControl("ddlInvFilterValue") as DropDownList;
if (d1.SelectedValue.Length > 0)
{
d2.Items.Clear();
d2.Items.Add(new ListItem(" - None - ", ""));
switch (d1.SelectedValue)
{
case "ServiceTeams":
foreach (var pair in serviceTeamsController.GetAllServiceTeamsLOVs())
{
if (!String.IsNullOrWhiteSpace(pair.Value))
d2.Items.Add(new ListItem(pair.Value, pair.Key));
}
break;
default:
foreach (var pair in masterController.GetMasterLOVs(filterTypeDict[d1.SelectedValue]))
{
if (!String.IsNullOrWhiteSpace(pair.Value))
{
d2.Items.Add(new ListItem(pair.Value, pair.Key));
}
}
break;
}
}
else
{
d2.Items.Clear();
d2.Items.Add(new ListItem(" - None - ", ""));
}
}
}
}
catch (Exception ex)
{
}
}
Heres a screenshot of what I'm looking at when theres more than one repeater item:
Basically whats happening now is if I update the filter type in item2 it will update the filter value in item 1. If I update the filter type in item1 it will update the filter value in item 1 as expected.
What I want is to be able to update item2 filter type and then the filter value in item 2 is updated accordingly.
Anyone have any ideas on what I could be missing?
So ended up getting this to work, I think the main issue was the clientidmode was confusing the update panel somehow, so I removed that and made the update panel go around both drop downs. I also didnt end up needing the trigger so I removed that as well.

in ASP.NET Add dynamic radiobutonlist inside a div which is inside a listview

I have a listview that contains divs in rows. All divs have there own controls working. One div contains radiobuttonlist which is getting data source from codebehind. The data is populated but the radiobuttonlist is carried outside of the relevent div.
Any help will be appreciated.
<div id="riDiv" class="rightDiv" runat="server">
<asp:ListView runat="server" ID="lvItemDetails" style="border:solid; border-color:blue; border-width:10px;">
<LayoutTemplate>
<div>
<table>
<tr runat="server" id="itemplaceholder" class="TopboxDiv">
</tr>
<tr runat="server" id="itemPlaceHolder2">
</tr>
</table>
</div>
</LayoutTemplate>
<ItemTemplate>
<tr>
<div class="TopboxDiv">
<asp:Literal ID="litItemDesc" Text='<%# ".." + Eval("item_description") %>' runat="server" />
</div>
</tr>
<tr>
<div class="MidboxDivWrapper" runat="server">
<div class="leftTagDiv">
<div class="pc">Price</div>
</div>
<div id="middiv" class="MidboxDiv" runat="server">
<%--<div id="innerRadDiv">--%>
<asp:Panel runat="server" ID="pnlMidBoxDiv" BorderStyle="Solid" BorderColor="Pink" BackColor="Aqua" style="z-index:2 !important;">
<span>
<asp:RadioButtonList ID="rdCrService" runat="server" DataTextField="ServiceName" DataValueField="ServiceName" RepeatDirection="Horizontal" CssClass="radioDiv" >
</asp:RadioButtonList>
</span>
</asp:Panel>
<%--</div>--%>
<div class="radioDiv">
<asp:RadioButton id="rdPost" Text="Postoffice Price" runat="server" CssClass="radiotext" GroupName="radPriceGroup" />
<asp:Literal ID="litPost" Text="Rs. 100" runat="server" />
</div>
<%--<div class="radioDiv">
<asp:RadioButton id="rdOCS" Text="OCS Price" runat="server" CssClass="radiotext" GroupName="radPriceGroup"/>
<asp:Literal ID="litOCS" Text="Rs. 110" runat="server" />
</div>
<div class="radioDiv">
<asp:RadioButton id="rdTCS" Text="TCS Price" runat="server" CssClass="radiotext" GroupName="radPriceGroup"/>
<asp:Literal ID="litTCS" Text="Rs. 120" runat="server" />
</div>
<div class="radioDiv">
<asp:RadioButton id="rdOther" Text="Other Price" runat="server" CssClass="radiotext" GroupName="radPriceGroup"/>
<asp:Literal ID="litOther" Text="Rs. 120" runat="server" />
</div>--%>
</div>
</div>
</tr>
<tr>
<div class="bottomDivItemWrapper">
<div class="leftTagDiv">
<div class="pc">Color</div>
</div>
<div class="bottomDivItem">
<div class="radioDiv">
<%--<asp:RadioButton ID="Rad1" Text='<%# Eval("ServiceName") %>' runat="server" GroupName="testGrp" CssClass="radiotext"/>--%>
<asp:RadioButton id="rdWhite" Text="white" runat="server" CssClass="radiotext" />
</div>
</div>
</div>
<div class="OrderDivWrapper">
add cart and wishlist buttons. write cart and wishlist code functions so it can be called again and again.
</div>
</tr>
</ItemTemplate>
</asp:ListView>
</div>
This is a pretty contrived example, but it's possible to databind the Radio Button Lists too. Below is an example; it's admittedly rather contrived, but it works.
First, the code-behind (including how I'm constructing the list). The details of getRandomString and getRandomListOfStrings aren't all that important - basically, I'm just generating random data to populate the front-end with. Obviously, you'll want to replace this with whatever your actual data source is.
private class Temp
{
public string MainName { get; set; }
// This is probably the key point here - I create a property to
// hold data to bind my radio buttons to
public List<string> RadioButtonOptions { get; set; }
}
private string getRandomString(Random r)
{
var sb = new StringBuilder();
int length = r.Next(3, 10);
for (int i = 0; i < length; i++)
{
int chr = r.Next(0, 60);
char result = (char)(33 + chr);
sb.Append(result);
}
return sb.ToString();
}
private List<string> getRandomListOfStrings(Random r)
{
int listLength = r.Next(3, 6);
var list = new List<string>();
for (int i = 0; i < listLength; i++)
{
list.Add(getRandomString(r));
}
return list;
}
protected void Page_Load(object sender, EventArgs e)
{
Random r = new Random();
var list = new List<Temp>
{
new Temp
{
MainName = getRandomString(r),
RadioButtonOptions = getRandomListOfStrings(r)
},
new Temp
{
MainName = getRandomString(r),
RadioButtonOptions = getRandomListOfStrings(r)
},
new Temp
{
MainName = getRandomString(r),
RadioButtonOptions = getRandomListOfStrings(r)
},
new Temp
{
MainName = getRandomString(r),
RadioButtonOptions = getRandomListOfStrings(r)
},
new Temp
{
MainName = getRandomString(r),
RadioButtonOptions = getRandomListOfStrings(r)
},
new Temp
{
MainName = getRandomString(r),
RadioButtonOptions = getRandomListOfStrings(r)
},
new Temp
{
MainName = getRandomString(r),
RadioButtonOptions = getRandomListOfStrings(r)
}
};
mainListView.DataSource = list;
mainListView.DataBind();
And the front end code:
<asp:ListView ID="mainListView" runat="server">
<ItemTemplate>
<asp:Label runat="server" Text='<%# Eval("MainName") %>' /><br />
<asp:RadioButtonList runat="server" DataSource='<%# Eval("RadioButtonOptions") %>'/><br />
<hr />
</ItemTemplate>
</asp:ListView>
The HTML for the radio buttons looks like this:
<tr>
<td><input id="mainListView_ctl01_1_0_1" type="radio" name="mainListView$ctrl1$ctl01" value="6U(" /><label for="mainListView_ctl01_1_0_1">6U(</label></td>
</tr>
And the front end looks something like this:

How to know which item is selected in the ListView in asp.net

I have a Listview which I have used to display messages.Along with each message there is a link to "Reply" message.Since different user can send message to one user.The user have different message from different user.Now i need to track each user who are sending message.I was wondering if there is a way to know which message is selected so that the sender's id can be traced.
Here is my List view.
<asp:ListView ID="msg_list" runat="server">
<ItemTemplate>
<table>
<tr class="myitem">
<td>
<asp:Label role="menuitem" ID="msg_lbl" runat="server" text='<%#Eval("msg")%>' /><i style=" color:Gray; " > from
<asp:Label ID="tme" runat="server" Text='<%#Eval("name")%>' />
<i> on </i>
<asp:Label ID="tmelbl" runat="server" Text='<%#Eval("tme")%>'/>
<a id="msg-reply" class="btn button" data-toggle="modal" data-target="#msg-rply" style="cursor:pointer;" ><i class="glyphicon glyphicon-share-alt white"> </i></a> </td>
<hr style=" margin-top:1px; margin-bottom:1px; " />
</tr>
</table>
<%--<hr style=" margin-top:1px; margin-bottom:1px; " />--%>
</ItemTemplate>
</asp:ListView>
With this list view i display the messages.In the above code you can see this line <a id="msg-reply" class="btn button" data-toggle="modal" data-target="#msg-rply" style="cursor:pointer;" ><i class="glyphicon glyphicon-share-alt white"> </i></a> </td>
So,when I click the icon a lightbox appears(modal of bootstrap) where i can write my message.
This lightbox has a button to send message(insert to database) which is as follows.
public void reply_msg(object sender, EventArgs e)
{
string tym = DateTime.Now.ToString();
string sid = Session["userid"].ToString();
//string rid = ((Label)msg_list.FindControl("easy")).Text;
//Label mr = (Label)msg_list.FindControl("reg_id_reply");
// string rid = mr.Text;
string rid = Session["msgreply"].ToString();
//msg_list.Items.FindControl("easy");
sc.connection();
SqlCommand cmd = new SqlCommand("insert into message(msg,senderId,receiverId,tme) values( #msg,#sid,#rid,#tme) ", sc.con);
cmd.Parameters.AddWithValue("#msg", ReplyMsgTb.Text);
cmd.Parameters.AddWithValue("#sid", sid);
cmd.Parameters.AddWithValue("#rid", rid);
cmd.Parameters.AddWithValue("#tme", tym);
cmd.ExecuteNonQuery();
sc.con.Dispose();
sc.con.Close();
}
What i need is to know which item of ListView is selected when i click the icon that brings out the lightbox to send message.
OR is there any other way to know which item of Listview is selected.
You can use check box with every row. So when the user checks the check box for the particular row you can easily reply to the selected user.
your code will be something like this:-
<asp:ListView ID="msg_list" runat="server">
<ItemTemplate>
<table>
<tr class="myitem">
<td>
<asp:TemplateField HeaderText="Id" ItemStyle-HorizontalAlign="Left">
<ItemTemplate >
<asp:CheckBox ID="chkRow" onclick ="CheckSingleCheckbox(this)" AutoPostBack="true" runat="server" OnCheckedChanged="chkRow_CheckedChanged"/>
</ItemTemplate>
</asp:TemplateField>
<asp:Label role="menuitem" ID="msg_lbl" runat="server" text='<%#Eval("msg")%>' /><i style=" color:Gray; " > from
<asp:Label ID="tme" runat="server" Text='<%#Eval("name")%>' />
<i> on </i>
<asp:Label ID="tmelbl" runat="server" Text='<%#Eval("tme")%>'/>
<a id="msg-reply" class="btn button" data-toggle="modal" data-target="#msg-rply" style="cursor:pointer;" ><i class="glyphicon glyphicon-share-alt white"> </i></a> </td>
<hr style=" margin-top:1px; margin-bottom:1px; " />
</tr>
</table>
<%--<hr style=" margin-top:1px; margin-bottom:1px; " />--%>
you can use the script given below for finding which check box has been checked:-
<script type="text/javascript">
function CheckSingleCheckbox(ob) {
var grid = ob.parentNode.parentNode.parentNode;
var inputs = grid.getElementsByTagName("input");
for (var i = 0; i < inputs.length; i++) {
if (inputs[i].type == "checkbox") {
if (ob.checked && inputs[i] != ob && inputs[i].checked) {
inputs[i].checked = false;
}
}
}
}
</script>

ASP.NET Passing variable from .aspx page to UserControl

I have a usercontrol that I want to pass a value to from my .aspx page. I've setup a property in the usercontrol to set to the value I need from the page but the value is always null.
Here is my control code in the .aspx page,
<tcs:SubmitDataDiscrepancy runat="server" ID="SubmitDataDiscrepancy" EntityNameProp='<%# Bind("Association_Name") %>'/>
the .ascx code,
<div style="text-align:right;">
<asp:LinkButton ID="ReportLink" runat="server" Text="Report data discrepancy"></asp:LinkButton>
<asp:Panel ID="ReportPanel" runat="server" CssClass="modalPopup" style="width:auto;">
<div id="PopHeader" style="background-color: black; color: white; height: auto;">
Report discrepancy
<div style="float: right;">
<asp:LinkButton runat="server" ID="AssociationCancelTextButton" CausesValidation="False" Font-Underline="false"
CssClass="glyphicon glyphicon-remove white" ToolTip="Close" />
</div>
</div>
<div style="margin:10px;">
<div>
Submit change request for: <asp:Label ID="EntityName" runat="server" />
</div>
<div>
<textarea id="reportTextArea" runat="server" class="form-control" style="height: 100px; margin-bottom:10px; width: 100%;"></textarea>
<button id="reportSubmitButton" runat="server" class="btn btn-primary" type="submit">Submit</button>
</div>
</div>
and the .ascx.cs page,
public partial class SubmitDataDiscrepancy : System.Web.UI.UserControl
{
public string EntityNameProp { get; set; }
protected void Page_Load(object sender, EventArgs e)
{
EntityName.Text = EntityNameProp;
}
}
Why am I not getting the value I'm expecting from the .aspx page?
All variables are disposed at the end of the page's lifecycle, that's the stateless nature of HTTP. So you need a way to persist your property. You could for example use ViewState, Session or a HiddenField (Other ways).
In this case it makes sense to simply use the Label.Text:
public partial class SubmitDataDiscrepancy : System.Web.UI.UserControl
{
public string EntityNameProp {
get { return EntityName.Text; }
set{ EntityName.Text = value; }
}
}

Dynamic jQuery 'add a textbox' to an asp:Repeater using C#

I'm having problems with a chunk of code that's meant to add a textbox to a Repeater in ASP.
I have the following:
<asp:Repeater ID="uxRolesList" runat="server">
<ItemTemplate>
<div id="<%# GetRolesDivId() %>" class="div_row">
<asp:TextBox ID="uxTxtBoxRole" runat="server" rows="5" columns="100" Text='<%# DataBinder.Eval(Container.DataItem, "RequirementDescription") %>' TextMode="multiline" MaxLength="2000"></asp:TextBox>
<input type="button" style="vertical-align:top;" value="X" class="remove-roles-btn" />
<br /><br />
</div>
</ItemTemplate>
</asp:Repeater>
Which generates a load of textboxes that look like this in the html:
<td id="rolesColumn">
<div id="roles-0" class="div_row">
<textarea name="ctl00$mainContent$uxRolesList$ctl00$uxTxtBoxRole" rows="5" cols="100" id="ctl00_mainContent_uxRolesList_ctl00_uxTxtBoxRole">Cool Job1</textarea>
<input type="button" style="vertical-align:top;" value="X" class="remove-roles-btn" />
<br /><br />
</div>
</td>
I've also added the following button, that should add a textbox to this list when hit:
<asp:Button CssClass="btn" ID="uxAddRoleBtn" runat="server" Text="Add a new role requirement" />
Using the following jQuery code:
$("#ctl00_mainContent_uxAddRoleBtn").live("click", (function (e) {
var rolesCounter = $('#ctl00_mainContent_uxTxtBoxRolesCount').val();
if (rolesCounter < 10) {
var rolesCounterText = "0" + rolesCounter;
} else {
var rolesCounterText = rolesCounter;
}
$('#rolesColumn').append("<div id='roles-" + rolesCounter + "' class='div_row'><textarea name='ctl00$mainContent$uxRolesList$ctl" + rolesCounterText + "$uxTxtBoxRole' rows='5' cols='100' id='ctl00_mainContent_uxRolesList_ctl" + rolesCounterText + "_uxTxtBoxRole' MaxLength='2000' ></textarea><input type='submit' name='ctl00$mainContent$uxRolesList$ctl" + rolesCounterText + "$uxRemoveRoleBtn' value='X' id='ctl00_mainContent_uxRolesList_ctl" + rolesCounterText + "_uxRemoveRoleBtn' class='remove-roles-btn' style='vertical-align:top;' /><br /><span id='ctl00_mainContent_uxRolesList_ctl" + rolesCounterText + "_uxValTxtBoxRole' style='color:Red;visibility:hidden;'>Please complete this role requirement</span><br /><br /></div>");
e.preventDefault();
rolesCounter++;
$('#ctl00_mainContent_uxTxtBoxRolesCount').val(rolesCounter);
}));
So far so good. I hit the add button and the textbox appears, I type something in, everything's great. The html look something like this:
<div id="roles-0" class="div_row">
<textarea id="ctl00_mainContent_uxRolesList_ctl00_uxTxtBoxRole" cols="100" rows="5" name="ctl00$mainContent$uxRolesList$ctl00$uxTxtBoxRole">Cool Job1</textarea><input class="remove-roles-btn" type="button" value="X" style="vertical-align:top;"><br><br>
</div>
<div id="roles-1" class="div_row">
<textarea id="ctl00_mainContent_uxRolesList_ctl01_uxTxtBoxRole" maxlength="2000" cols="100" rows="5" name="ctl00$mainContent$uxRolesList$ctl01$uxTxtBoxRole">Test</textarea><input class="remove-roles-btn" type="submit" style="vertical-align:top;" value="X" name="ctl00$mainContent$uxRolesList$ctl01$uxRemoveRoleBtn"><br><br>
</div>
Then I hit submit and the new values do not come through.
In the C# side I'm trying to access the data using:
foreach (RepeaterItem item in dl.Items)
{
System.Web.UI.WebControls.TextBox rb = item.FindControl(control) as System.Web.UI.WebControls.TextBox;
if (rb.Text.Trim() != "")
{
PositionRequirement pr = new PositionRequirement();
pr.RequirementDescription = rb.Text;
pr.RequirementLevel = new PositionRequirementLevel(level, levelDescription);
pr.OrderNumber = i;
i++;
positionRequirements.Add(pr);
}
}
where dl = uxRolesList
control = uxTxtBoxRole
I'm at an utter loss as to why the new values are not coming through with the uxRolesList Repeater.
What am I doing wrong?
from what i know , the approach used is not going to show the items that are added within the Repeater Datasource, unless they exist before the page is being served to the user, so in the example, only the items that were bound to the repeater before leaving the server (if any) will show.
if you don't want to leave the page and make a trip to the server on every add click,of the top my head i would suggest that you would access them via the request Object using the name instead of the id ( Request[""] ) and keep the name of each textbox similar ("txtbox1","txtbox2")and append the count as you did in your Jquery code, then on the server when the page is submitted loop over the items using the counter that you have stored in uxTxtBoxRolesCount.

Categories

Resources