hold checkbox values

Answers were Sorted based on User's Feedback



hold checkbox values..

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

hold checkbox values..

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

hold checkbox values..

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

hold checkbox values..

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

Post New Answer

More ASP.NET Code Interview Questions

Listview design in .net

1 Answers  


How to get the row index on checking a Checkbox in a ListView

1 Answers  


How to Bind Nested XML to a Repeater Control with Container.DataItem?

0 Answers  


how to track links visited in google using iframes

0 Answers  


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.

0 Answers   TCS,






hold checkbox values

4 Answers  


How to get Dynamically Linked Comboboxes Set?

0 Answers   HCL,


What is the code of Password Recovery or Forget your password? Plz tell in c # language.

0 Answers  


Code for Presenting Parent/Child Data in a Data Grid Row?

0 Answers   TCS,


Code for Creating a Form Using PlaceHolder Controls?

0 Answers   Arena, JSA,


Give coding for Exception Handling Techniques in ASP.NET?

3 Answers   Microsoft,


how to upload a photo? i need to use it in a matrimonial applicaton...

1 Answers  


Categories
  • ASP.NET Code Interview Questions ASP.NET Code (46)
  • VB.NET Code Interview Questions VB.NET Code (9)
  • C Sharp Code Interview Questions C Sharp Code (51)
  • ADO.NET Code Interview Questions ADO.NET Code (8)