Click here to Skip to main content
15,889,462 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i have one dropdownlist. in that dropdownlist Dates are there.

Bathdate 21 jun 2015

coursedate 22 jun 2015

i want to save Selected Batchdate in viewstate. (21 jun 2015)

And compare viewstate date with coursedate (22 jun 2015)


if both date are not continous i want to show the message as follows.

Both date must be continous.

for that how can i do in asp.net using csharp.
Posted
Comments
Arkadeep De 30-Jun-15 3:43am    
If the drop down list is asp control then on selected change put the selected value to viewstate
else if it is html controller pass the data to controller via jquery and save it in viewstate.
or you can get the value of a html drop down list value in code behind by
string value= Request.Form["Drop"];
where name of the DropDown is "Drop"

U can follow the solution given by Arkadeep.

Viewstate is for a page. If at all your going to navigate to other screen then you can use query string or Session.
 
Share this answer
 
you can save your dropdownlist selected value in viewstate as :

C#
ViewState["selectdate"] = dropdownlist1.SelectedValue;


Follow this link to have more idea about ViewState.
[Beginner-s-Guide-To-View-State]
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900