hold checkbox values
Answers were Sorted based on User's Feedback
Answer / sona
this one fr retrieving
private void CheckChkBoxStatusRetrieve()
{
ArrayList objChkBoxRetrieve=new ArrayList();
if (Cache[(Session["Userid"]
+ "BankReconChkBoxID")] != null)
{
objChkBoxRetrieve=(ArrayList)Cache[(Session
["Userid"] + "BankReconChkBoxID")];
for (int j = 0; j <
objChkBoxRetrieve.Count; j++)
{
for (int i = 0; i < CurPageCnt; i++)
{
if (objChkBoxRetrieve[j].ToString()
== ((Label)lstBankReconcilation.Items[i].FindControl
("lblVoucherId")).Text)//lblVoucherNo
{
((CheckBox)
lstBankReconcilation.Items[i].FindControl
("chkReconcile")).Checked = true;
((TextBox)
lstBankReconcilation.Items[i].FindControl
("txtReconcileDate")).Text = DateTime.Now.ToString
("dd/MM/yyyy");
}
}
}
}
}
Is This Answer Correct ? | 3 Yes | 0 No |
Answer / sona
1]
http://blog.evonet.com.au/post/2008/08/Maintaining-Checkbox-State-in-a-Listview.aspx
2]
http://demo.evonet.com.au/MaintainingListviewCheckboxState.aspx
3]
http://www.codeproject.com/KB/webforms/States_of_CheckBoxes.aspx
4] http://forums.asp.net/t/1282544.aspx
5]
http://www.ilearnttoday.com/index.php/c-aspnet-gridview-how-to-keep-modified-data-of-template-fields-when-paging-is-enabled/comment-page-1
Is This Answer Correct ? | 2 Yes | 0 No |
Answer / sona
private void CheckChkBoxStatusHold()
{
ArrayList objChkBoxID = new ArrayList();
if (Cache[(Session["Userid"]
+ "BankReconChkBoxID")] != null)
{
objChkBoxID=(ArrayList)Cache[(Session
["Userid"] + "BankReconChkBoxID")];
}
for (int i = 0; i < CurPageCnt; i++)
{
if (intCheckSave == 1)
{
if (((CheckBox)
lstBankReconcilation.Items[i].FindControl
("chkReconcile")).Checked == true)
{
objChkBoxID.Add(((Label)
lstBankReconcilation.Items[i].FindControl
("lblVoucherId")).Text);
DateTime dtReconDate =
Convert.ToDateTime((((TextBox)lstBankReconcilation.Items
[i].FindControl("txtReconcileDate")).Text), new CultureInfo
("hi-IN"));
objChkBoxID.Add(dtReconDate.ToString
("dd-MMM-yyyy"));
}
}
else if (intCheckSave == 0)
{
if (((CheckBox)
lstBankReconcilation.Items[i].FindControl
("chkReconcile")).Checked == false)
{
objChkBoxID.Add(((Label)
lstBankReconcilation.Items[i].FindControl
("lblVoucherId")).Text);
DateTime dtReconDate =
Convert.ToDateTime((((TextBox)lstBankReconcilation.Items
[i].FindControl("txtReconcileDate")).Text), new CultureInfo
("hi-IN"));
objChkBoxID.Add(dtReconDate.ToString
("dd-MMM-yyyy"));
}
}
}
Cache.Remove((Session["Userid"]
+ "BankReconChkBoxID"));
Cache[(Session["Userid"]
+ "BankReconChkBoxID")] = objChkBoxID;
}
Is This Answer Correct ? | 1 Yes | 1 No |
Answer / kris
private List<int> IDs
{
get
{
if (this.ViewState["IDs"] == null)
{
this.ViewState["IDs"] = new List<int>();
}
return (List<int>)this.ViewState["IDs"];
}
}
protected void AddRowstoIDList()
{
int checkAction = 0;
foreach (ListViewDataItem lvi in lvUsersinGroup.Items)
{
CheckBox chkSelect =
(CheckBox)lvi.FindControl("chkSelect");
if ((((chkSelect) != null)))
{
int ID =
Convert.ToInt32(lvUsersinGroup.DataKeys[lvi.DisplayIndex].Value);
if ((chkSelect.Checked &&
!this.IDs.Contains(ID)))
{
this.IDs.Add(ID);
checkAction += 1;
}
else if ((!chkSelect.Checked &&
this.IDs.Contains(ID)))
{
this.IDs.Remove(ID);
}
}
}
}
Is This Answer Correct ? | 0 Yes | 1 No |
How we implement the paypal in my website and how we make a payment through Credit Card.
Code for Creating a Form Using PlaceHolder Controls?
hold checkbox values
How to Export Data to Excel?
what is the value that reside in a hidden field when no value is assigned to it?how it can be used in a if statement??
how to convert Dataset to Object Array or list in c# .net
Listview design in .net
HOw to Build a Nested GridView Control with ASP.NET?
What is the code of Password Recovery or Forget your password? Plz tell in c # language.
How to get Dynamically Linked Comboboxes Set?
how to create a search bar which access data from various websites and retrieves the data
what is software testing