Click here to Skip to main content
15,916,091 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

I have a problem in preserving the values in the textbox after dropdownlist selected index changed in asp.net mvc. Below is the code for initiating the dropdown onchange event.

@Html.DropDownList("BranchId",null,"Select Branch", new { onchange = "location.href='/User/GetRoles?BranchId='+this.options[this.selectedIndex].value" })

and the roles dropdown binded with the values, but what i typed in the textboxes just above the branch dropdown get lost.

Please help me

Regards
Azeem
Posted
Comments
TryAndSucceed 6-Sep-13 10:25am    
Didn't you just do a postback for OnChange event? And if you are not storing your values, then you obviously loose it.
Ahamed Azeem 6-Sep-13 10:32am    
Yes i know, how can i store values that were in the view which i was just typed
Jameel VM 6-Sep-13 14:02pm    
send an ajax request. i think you are redirect to some where else.So you will lost all data
[no name] 14-Dec-13 13:18pm    
yes you can send the requested by ajax. or you can render your desired output by creating partial view and calling it.

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