Tips Station Asp.net Article Seo Articles
Tutorials Code Samples
›  Home
›  Mission
›  About us
›  Contact Us
›  Feedback
›  Terms & Condition
Asp Articles
IT Solutions
 
› ASP.NET

› Programming Tips

› Ajax

› Asp

› ADO.NET

› Databases

› SEO

› CSS And Designing

› Php

 
Most Viewed Articles
 
› Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.

› Change theme dynamically without page refresh in ASP.NET

› Simple ASP Image Resize Function

› Install AJAX On Machines Running Visual Studio 2005

› ASP.Net Interview Questions And Their Answers

› Creating Pretty Popups Using AJAX

› Encode Url using ASP

› SQL Server Performance Counters

› .NET Data Access Performance Comparison

› UpdatePanel control in Asp.net Ajax

more...
 
 
Home> ASP.NET
 
Select Specific Value WithIn Drop Down List Or Radio Button List
 

I want to share one very useful tip with you. When we have to select specific value in a drop down list or radio button list then we normally use the following syntax:

For Drop Down List
DropDownListID.Items.FindByValue("VALUE_HERE").Selected = True

For Radio Button List
RadioButtonListID.Items.FindByValue("VALUE_HERE").Selected = True

If the provided value does not exist then it gives the error. So, we write the above code in "Try Catch" block like this:

Try
  DropDownListID.Items.FindByValue("VALUE_HERE").Selected = True
Catch ex
End Try

Try
  RadioButtonListID.Items.FindByValue("VALUE_HERE").Selected = True
Catch ex
End Try

In my opinion the alternate and the best way to select the specific value is using the Text property of the drop down list or radio button list. The syntax is given below:

For Drop Down List
DropDownListID.Text = "VALUE_HERE"

For Radio Button List
RadioButtonListID.Text = "VALUE_HERE"

In the above code there is no need of using "Try Catch" block.

 
 
Vrp Technologies
 
Serversea Hosting
 
 
Latest Articles
 
› Sending SMS With PHP

› MySQL Join Tutorial

› Make An RSS Feed Using PHP

› Intro To Object: Option Variables

› Design An Online Chat Room With PHP And MySQL

› Create Tell A Friend Script With HTML & PHP

› Benchmark And Optimize PHP Script Speed

› What Kind of DBA Are You?

› SQL Server Performance Counters

› SQL Server Performance Tips

more...
 
Random Articles
 
› Get To The Top 10 Website Search Engine Rank In 5 Easy Steps

› Read and display a text file in Asp.net

› Select Specific Value WithIn Drop Down List Or Radio Button List

› ASP.Net Tips and Tricks

› Session Object in Asp

› Encode Url using ASP

› Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.

› Benchmark And Optimize PHP Script Speed

› Displaying Data using ASP.NET 2.0 DataList

› SubRoutines vs. Functions - ASP

more...
 
Home Mission About us Contact us Feedback Terms Conditions
2008 © Copyright TipsStation. All rights reserved.