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

› Install AJAX On Machines Running Visual Studio 2005

› Creating Pretty Popups Using AJAX

› Simple ASP Image Resize Function

› SQL Server Performance Counters

› ASP.Net Interview Questions And Their Answers

› Encode Url using ASP

› Difference Between DataGrid and GridView in Asp.Net

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

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
 
› Ten Tips To Optimize Your Website

› Session Object in Asp

› Cache Data within your Application - Asp.Net

› Get Environment Details - Asp.Net

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

› CSS Cursors - How To Use Them

› SubRoutines vs. Functions - ASP

› How to Start with ASP.NET AJAX

› Choosing a Web Site Hosting Provider for an ASP.NET Site

› Get To The Top 10 Website Search Engine Rank In 5 Easy Steps

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