Friday, September 19, 2014

Get HTML Select(Drop Down List) value in Code Behind (C#) in ASP.NET

Sometimes its very mush important to get the value of the HTML Drop Down List, Select value from the code behind (C#). So how to get the value of a HTML control value in the code behind. A very easy thing to do.

Create a new project and add a WebForm and add a new select tag with some value. Like this



Now in the C# page write the code to get the value.
string ddl = "";
// to get the selected value
ddl = Requets.Form["ddl"].ToString();

To get the selected value the actual code is
Requets.Form["ddl"]

In this way you can get the data of a HTML field from code behind (C#). With in that click event write down the following code

2 comments:

Popular Posts

Pageviews