This is a discussion on Create control according to their data type within the .Net Development forums, part of the Programming & Scripting category; hey J I m using repeater and so far i converted code here.see the bold part .i m not using ...
| |||||||
|
#41
| ||||
| ||||
| hey J I m using repeater and so far i converted code here.see the bold part .i m not using list view . this line Listview1.DataKeys(lvi.DisplayIndex).Value is for list view i want this line converted for repeater. Code: public void AddRowstoIDList()
{
// Loop through all the current items in the Listview
foreach (RepeaterItem item in rptExtraInfo.Items)
{
CheckBox chkbox = (CheckBox)item.FindControl("chkBox");
if ((((chkbox) != null)))
{
int ID = Convert.ToInt32(rptExtraInfo.Items[item.ItemIndex].ItemIndex);
if ((chkbox.Checked && !this.IDs.Contains(ID)))
{
// Add the ID to our list
this.IDs.Add(ID);
}
else if ((!chkbox.Checked && this.IDs.Contains(ID))) {
// Not checked - remove the ID from our list
this.IDs.Remove(ID);
}
}
}
__________________ Love is physical attraction and mental destruction |
|
#42
| ||||
| ||||
| this line is not working. Code: int ID = Convert.ToInt32(rptExtraInfo.Items[item.ItemIndex].ItemIndex); |
|
#43
| ||||
| ||||
| You need to use the FindControl method. You can call this within the ItemCommand event or the ItemDataBound event, for example. It just depends on what you're trying to do.
__________________ jmurrayhead If you agree with me... click the icon! If my post solved your problem, click the button in the lower right-hand corner of the post.If you like it here...throw us a few bones to help support us. Join our Folding team: DeveloperBarn Folding |
|
#44
| ||||
| ||||
| hi even my check box is checked but this always return false Code: CheckBox chkbox = (CheckBox)item.FindControl("chkBox");
if (chkbox.Checked)
|
|
#46
| ||||
| ||||
| ok now check box issue is resolved.now i m able to maintain the state of check box.but how to maintain state of text box.The link u have given about check box is using list to maintain id. but for text box i want to maintain id and corrsponding value .how to do this? |
|
#47
| ||||
| ||||
| It's the same concept as the checkbox, but you need to store the additional value. The checkbox example only stores the ID's of checkboxes that are checked. So you'll only want to store the ID's of textboxes that actually have text. You could store a DataTable in viewstate instead of a List. This would allow you to have two columns (id and value). |
|
#48
| ||||
| ||||
| hi actually now i m using Hash table to store key and value.below code in repeater creates text boxes.in asp what we do give unqiue name to each text boxes when we create no of text boxes from database.so that we uniquelly identify them.but in .net how to identify the, uniquelly. Code: <asp:TextBox runat="server" Visible='<%#VisibleTextBoxYesNo(DataBinder.Eval(Container .DataItem,
"DataTypeN0").ToString())%>' ID='txtBox'></asp:TextBox>
|
|
#50
| ||||
| ||||
| i want to access that ids in one of my method.how can we access.these controls are in repeater.i want to access them in below method not in ItemCommand event or the ItemDataBound event. public void AddRowstoIDList() { } |
![]() |
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Create/Print Form data | Rebelle | ASP Development | 5 | December 10th, 2008 10:25 AM |
| Binding data to the RadioButtonList Control | Shem | .Net Development | 2 | December 3rd, 2008 02:42 AM |
| The data source 'ObjectDataSource1' does not support sorting with IEnumerable data | Shem | .Net Development | 5 | June 25th, 2008 08:07 AM |
| Data Type Mismatch in Criteria Expression | alansidman | Microsoft Access | 1 | April 9th, 2008 04:33 PM |
| [Error] Type mismatch: HTMLEncode | Rebelle | ASP Development | 20 | March 28th, 2008 09:30 AM |