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 |
Listview design in .net
How to get the row index on checking a Checkbox in a ListView
How to Bind Nested XML to a Repeater Control with Container.DataItem?
how to track links visited in google using iframes
Common UI for Multiple web applications. Suppose there are 35 websites using same third party controls.These 3rd party controls are made together that all 35 websites can use these controls.If we put all 3rd party controls and use its dll in 35 websites,only class files will be accessable. But I want to use CSS,images also in all 35 websites. how I can design the N-tier solution for this project.
hold checkbox values
How to get Dynamically Linked Comboboxes Set?
What is the code of Password Recovery or Forget your password? Plz tell in c # language.
Code for Presenting Parent/Child Data in a Data Grid Row?
Code for Creating a Form Using PlaceHolder Controls?
Give coding for Exception Handling Techniques in ASP.NET?
how to upload a photo? i need to use it in a matrimonial applicaton...