C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




How to retain the value in a dropdownlist after a post back


Posted Date: 08 Jul 2008      Total Responses: 9

Posted By: Ferdin Sylvester M I       Member Level: Gold     Points: 1



Hi,
for my previous post i got the result, now in the ddl i m inserting the values using property window in design mode and during execution during selectedindex change event,ddl is not retaing the value i have written the code as below:
protected void ddlFil_SelectedIndexChanged(object sender, EventArgs e)
{
if (Convert.ToInt32(ddlFil.SelectedItem.value)== 1)
{
Response.Redirect("pAssUsr.aspx");
}
}
In the above code eventhough the selected value is 1 i m seeing 0 during debuging this is becoz after post back the value is not retained in the ddl... how to make the ddl to retain the value...





Responses

Author: venkatesan    08 Jul 2008Member Level: DiamondRating:     Points: 1

Hai

use viewstate to retain the value After the postback

even u can use global variables...



Wish u a Very Happy New Year
Regards,
M.Venkatesan.

Please remember to Rate “Excellent or Good or Poor”



Author: Ferdin Sylvester M I    08 Jul 2008Member Level: GoldRating:     Points: 1

Hi Venkat,
Can u explain little briefly how to use viewstate to retain the value with code...



Author: Ferdin Sylvester M I    08 Jul 2008Member Level: GoldRating:     Points: 1

Hi Venkat,
Can u explain little briefly how to use viewstate to retain the value with code...



Author: Ferdin Sylvester M I    08 Jul 2008Member Level: GoldRating:     Points: 1

Hi Venkat,
Can u explain little briefly how to use viewstate to retain the value with code...



Author: Ferdin Sylvester M I    08 Jul 2008Member Level: GoldRating:     Points: 1

Hi Venkat,
Can u explain little briefly how to use viewstate to retain the value with code...



Author: venkatesan    08 Jul 2008Member Level: DiamondRating:     Points: 3


this is Ex:


viewsate["name"]=dropdownlist1.SelectedValue

Let me know ? get back to me

Note:If its useful Rate the Article



Wish u a Very Happy New Year
Regards,
M.Venkatesan.

Please remember to Rate “Excellent or Good or Poor”



Author: venkatesan    08 Jul 2008Member Level: DiamondRating:     Points: 1

You can retrieve

the viewstate value like

string s;
s=ViewState["name"];




Wish u a Very Happy New Year
Regards,
M.Venkatesan.

Please remember to Rate “Excellent or Good or Poor”



Author: Anithadevi    08 Jul 2008Member Level: GoldRating:     Points: 1

give the auto post back property as true for that ddl


Author: Saroo T    08 Jul 2008Member Level: BronzeRating:     Points: 1

Just set the property for dropdownlist Autopostback=true
It will solve your problem



Post Reply
You must Sign In to post a response.
Next : Connections..?
Previous : Crystal Report Error
Return to Discussion Forum
Post New Message
Category: ASP.NET

Related Messages



dotNet Slackers   BizTalk Adaptors    Web Design


Contact Us    Privacy Policy    Terms Of Use