Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Reset DropDown to Default

Reply
Thread Tools

Reset DropDown to Default

 
 
Thom Little
Guest
Posts: n/a
 
      08-05-2004
I want to manually reset the DropDownList when using AutoPostBack to its
default value that has entry 0 as the default.

The following puts the select name and value in two labels and resets the
dropdown to the default.

private void ddlA_SelectedIndexChanged(object sender, System.EventArgs e )
{
string strValue = ddlA.SelectedItem.Value ;
lblA.Text = ddlA.SelectedItem.Text;
lblB.Text = strValue ;
ddlA.SelectedIndex = 0 ;
Response.Write( "" );
}

The following does not put the selected name and value in the two labels and
does not reset the dropdown to the default but it does transfer to the URL
in the selected value.

private void ddlA_SelectedIndexChanged(object sender, System.EventArgs e )
{
string strValue = ddlA.SelectedItem.Value ;
lblA.Text = ddlA.SelectedItem.Text;
lblB.Text = strValue ;
ddlA.SelectedIndex = 0 ;
Response.Write( "" );
Response.Redirect( "http://" + strValue );
}

How can I reset the index and also do the redirect?

I can not disable the Cache because I want this code to work in browsers
other than Internet Explorer.

--
-- Thom Little -- www.tlaNET.net -- Thom Little Associates, Ltd.
--



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
You will not be able to reset the access - can't reset. jc MCAD 0 12-09-2007 08:58 PM
Reset DropDown Thom Little ASP .Net Web Controls 0 08-16-2006 02:47 PM
CISCO 7XX / 761 password reset or reset to factory defaults Philipp Flesch Cisco 3 06-18-2006 07:47 PM
bind a dropdown in a column in a datagrid based on the dropdown value selected in another column of the datagrid. vishnu ASP .Net 1 03-25-2006 01:24 PM
HELP! dropdown control is being reset to a value on every postback! Mad Scientist Jr ASP .Net 1 06-25-2004 02:12 PM



Advertisments