ok meant i m doing in the same way u said.now i m facing very weired problem.
see adding in list and hash table i m using below code
Code:
for (int i = 0; i < rptExtraInfo.Items.Count; i++)
{
CheckBox chkbox = (CheckBox)rptExtraInfo.Items[i].FindControl("chkBox");
TextBox txtbox = (TextBox)rptExtraInfo.Items[i].FindControl("txtBox");
int ID = Convert.ToInt32(rptExtraInfo.Items[i].ItemIndex);
if (txtbox.Text != "" && !HashTableSample.table.Contains(ID))
{
HashTableSample.AddEntry(rptExtraInfo.Items[i].ItemIndex.ToString(), txtbox.Text);
}
else if (txtbox.Text == "" && HashTableSample.table.Contains(ID))
{
HashTableSample.table.Remove(ID);
}
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);
}
}
for maintaining state i m pulling data from list or hash table and assigning back to text boxes and check boxes.so that during page navigation data will not lost which is entered by me.
Code:
protected void rptExtraInfo_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
RepeaterItem lvi = e.Item;
TextBox txtbox = (TextBox)lvi.FindControl("txtBox");
if ((((txtbox) != null)))
{
int ID = Convert.ToInt32(lvi.ItemIndex);
txtbox.Text = HashTableSample.FindEntry(lvi.ItemIndex).ToString();
}
// Find the checkbox in the current row
CheckBox chkSelect = (CheckBox)lvi.FindControl("chkBox");
// Make sure we're referencing the correct control
if ((((chkSelect) != null)))
{
// If the ID exists in our list then check the checkbox
int ID = Convert.ToInt32(lvi.ItemIndex);
chkSelect.Checked = this.IDs.Contains(ID);
}
}
now problem is the data which i entered at first page also displaying in 2 page ,3rd page so on.so i m missing something.bcoz at each page i will enter different data.i dont understand why data of first page displaying all other pages.
Hope it make some sense.
Bookmarks