Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Jun 27, 2012 08:15 AM by adeelehsan
Member
11 Points
103 Posts
Jun 27, 2012 07:11 AM|LINK
hi
i have one checkbox and i want to store checkbox value in dictionary how can i do. im using that code
Dictionary<string, string> valuestore = new Dictionary<string, string>();
valuestore.Add(TxtpartNumber.ID.ToString(), Txtpart.Text); valuestore.Add(TxtDescription.ID.ToString(), TxtDes.Text); valuestore.Add(ddl_InvType.ID.ToString(), ddl_Inv.SelectedValue); valuestore.Add(ddl_RecInvStatus.ID.ToString(), ddl_Rec.SelectedValue);
All-Star
18279 Points
2733 Posts
Jun 27, 2012 07:18 AM|LINK
Do you want to store the checked or unchecked status of the checkbox? If yes then use the following:
valuestore.Add("CheckedStatus",CheckBox1.Checked.ToString());
31378 Points
5422 Posts
hi, refer below code
valuestore.Add(checkBox.ID, checkBox.Checked.ToString());
to retrieve just convert the value to boolean
380 Points
65 Posts
Jun 27, 2012 07:20 AM|LINK
Hi, checkbox' value is a boolean variable, so in your code we can use it this way:
valuestore.Add(checkbox1.ID.ToString(), checkbox1.Checked);
If it's checked, then we'll store TRUE or 1. If not, then it will be FALSE or 0;
Jun 27, 2012 07:29 AM|LINK
valuestore = (Dictionary<string, string>)Session["value"]; Txtpart.Text = valuestore[TxtpartNumber.ID.ToString()].ToString(); TxtDesc.Text = valuestore[TxtDescription.ID.ToString()].ToString();
store successfully
and how can i get
Jun 27, 2012 08:15 AM|LINK
Use the following:
String s = valuesstore[TxtpartNumber.ID.ToString()]; //or for checkbox String s1 = valuesstore[Checkbox1.ID.ToString()];
zohaibak
Member
11 Points
103 Posts
checkbox value store in dictionary
Jun 27, 2012 07:11 AM|LINK
hi
i have one checkbox and i want to store checkbox value in dictionary how can i do. im using that code
Dictionary<string, string> valuestore = new Dictionary<string, string>();
valuestore.Add(TxtpartNumber.ID.ToString(), Txtpart.Text);
valuestore.Add(TxtDescription.ID.ToString(), TxtDes.Text);
valuestore.Add(ddl_InvType.ID.ToString(), ddl_Inv.SelectedValue);
valuestore.Add(ddl_RecInvStatus.ID.ToString(), ddl_Rec.SelectedValue);
adeelehsan
All-Star
18279 Points
2733 Posts
Re: checkbox value store in dictionary
Jun 27, 2012 07:18 AM|LINK
Do you want to store the checked or unchecked status of the checkbox? If yes then use the following:
valuestore.Add("CheckedStatus",CheckBox1.Checked.ToString());
MCPD ASP.NET 4.0 and 3.5, MCTS WSS, MOSS, SharePoint 2010, MCT
Microsoft Community Contributor Award 2011
karthicks
All-Star
31378 Points
5422 Posts
Re: checkbox value store in dictionary
Jun 27, 2012 07:18 AM|LINK
hi, refer below code
Dictionary<string, string> valuestore = new Dictionary<string, string>();
valuestore.Add(checkBox.ID, checkBox.Checked.ToString());
to retrieve just convert the value to boolean
Karthick S
Pupuru
Member
380 Points
65 Posts
Re: checkbox value store in dictionary
Jun 27, 2012 07:20 AM|LINK
Hi, checkbox' value is a boolean variable, so in your code we can use it this way:
If it's checked, then we'll store TRUE or 1. If not, then it will be FALSE or 0;
Lead Business Process Analyst for CFM System Project
Colliers International
zohaibak
Member
11 Points
103 Posts
Re: checkbox value store in dictionary
Jun 27, 2012 07:29 AM|LINK
valuestore = (Dictionary<string, string>)Session["value"];
Txtpart.Text = valuestore[TxtpartNumber.ID.ToString()].ToString();
TxtDesc.Text = valuestore[TxtDescription.ID.ToString()].ToString();
store successfully
and how can i get
adeelehsan
All-Star
18279 Points
2733 Posts
Re: checkbox value store in dictionary
Jun 27, 2012 08:15 AM|LINK
Use the following:
MCPD ASP.NET 4.0 and 3.5, MCTS WSS, MOSS, SharePoint 2010, MCT
Microsoft Community Contributor Award 2011