Web Forms :: Clear DropDownList On Postback?

Nov 29, 2010

i have two radio button list on my page on my Frist Index there is a panel with Drop Down List and on Second Index there is a static variable in which i am storing value as Pending

now as soon as i select my Second RadioButtonList it also stores the DropDown List Value

how i can clear the DropDown List Value?

My Code

[Code]....

My Page Source

[Code]....

View 6 Replies


Similar Messages:

Web Forms :: DropdownList Selected Value Clear (lost) After Every Postback

Feb 25, 2016

I have the problem with dropdownlist value inside gridview.my problem is i have textbox,button with two dropdownlists, dropdownlists are inside gridview.Two dropdownlists are  one is ddlcountry and another one is ddlstates. if i select  country from ddlcountry , country related states comes in ddlstates. after entering  first record value in textbox then button click  textbox value is shown in gridview with two dropdown lists dropdown list, after selecting one dropdownlist country and states, i enter second record value and button click then only country selected value visible ddlstates selectedvalue not visible in first record in gridview...

View 1 Replies

Data Controls :: Clear Cascading DropDownList Selection When Parent DropDownList Is Changed

Jan 8, 2013

I am having two dropdownlist in my project,one dropdownlist for empid, another dropdownlist for month, if the user select the empid, the values are retrieved in the textbox.

In the second dropdownlist, if the user select the month in the dropdownlist it will display the leave details, its all working fine, if the user again select the first dropdownlist that means empid, I want to show the second dropdownlist as select month, how can do this.....

View 1 Replies

Web Forms :: How To Clear DropDownList Selected Item

Apr 22, 2013

I have dropdownlist in my page

In Page_load page I wrote below code

  if (!IsPostBack) {
DDL1.Items.Insert(0, new ListItem("select city", "0"));
DDL2.Items.Insert(0, new ListItem("select region", "0"));
DdlDistrict.Items.Insert(0, new ListItem("select district", "0"));
}

And in this page I have btnInsert that when users click on it, it insert data in database

I want when users click on button all textboxs text be clear and all DDL selected Item clear so I set below code in btnInsert event

protected void imginsert_Click(object sender, ImageClickEventArgs e) {
SqlCommand _cmd = new SqlCommand("insertFreg", _cn);
_cmd.CommandType = CommandType.StoredProcedure;
_cn.Open();
_cmd.Parameters.AddWithValue("@address", txtsdd.Text);
_cmd.Parameters.AddWithValue("@Aname", txtAname.Text);

[Code] .....

But here when I click on button it clear textboxs text but it didn't do any thing on Dropdownlist i.e

If I select 'Paris' from DDL1 when I click on button I want It show in ddl1 'Select city'

But it show 'Paris' again

What should I do?

View 1 Replies

Web Forms :: Clear Text In Ajax ComboBox Or DropDownList?

Jan 27, 2011

When the WebPage loads i would like for the Text to be cleared in Ajax ComboBox and/or DropDownList. However Setting the text to nothing or null doesn't seem to work. So I did some searching and found this...

[Code]....

Is there another way to clear the text other then adding a null item to the list? I don't really want the user to have a selection of "null", this seems like a hack job.

View 9 Replies

Web Forms :: How To Clear All Fields Like DropDownList TextBox After Form Submission

May 7, 2015

i am using html input fields for inserting data to db e.g.:

<input type="text" runat="server" ClientIDMode="Static" id="StreetNo" class="form-control input-mask-phone"/>
and a submit button for submitting all data :

<button class="btn btn-info btn-block" style="height: 40px;" OnServerClick="SubmitProject_OnServerClick" ValidationGroup="Date" type="button" runat="server" ClientIDMode="Static" id="SubmitProject"> Submit </button>

also i am using an update panel to trigger this button click event ( to avoid postbacks and page refreshing ) . i want to clear out all my fields after submition of data , but it won't happens , even i tried on submit_click's event also , i did :

/// after submittion
StreetNo.Value = string.Empty;

but nothing happend ..

View 1 Replies

Clear Form On Postback?

Mar 24, 2011

Is there a simple way to clear the value of server controls on postback? I have tried ViewState.clear() and it doesn't do anything. The page I am working on inherits from a Masterpage that has viewstate enabled.

View 3 Replies

Web Forms :: Disable Postback When Select Dropdownlist To Control Other Two Dropdownlist Value

Mar 25, 2011

I had use a combox to let user select staff name and then it will automatically retrive the responsible recommending officer and approving officer to display in other 2 dropdownlist.

my code works fine but when user select staff name each time, the page will reload once to refresh the dropdownlist.

user complaint and don't want the page reload every time, how can i disable the postback? I need to use ajax?

[Code]....

[Code]....

View 5 Replies

AJAX :: Postback Causes MaskedEditExtender To Clear Current Value?

Feb 26, 2010

For many of the Ajax ControlToolkit, a post back causes a lot of screw up with these controls. One example is the MaskedEditExtender. I have a webform that has various parts which depends on a RadioButtonList control option. Some part of webform maybe hidden or shown base on what option the user chose from the RadioButtonList control. The RadioButtonList control is set to autopostback. Let's say there is the txtDate textbox that regardless what option the user chose from the RadiobuttonList control, it will always shown on the webform. Let's say the user type in 2/5/2010 on the txtDate control but later on decides to pick a different option in the RadioButtonList control. After the autopostback from the RadioButtonList control, the txtDate that contained 2/5/2010 is now wiped out or cleared. So, my question is, how do I prevent this from happening?

View 1 Replies

State Management :: Clear A Textbox On Postback?

May 26, 2010

I have a form that takes the user information. When the user submits the form, after the postback, I need to get all some of the textboxes in the form cleared. I tried disabling the ViewState and ViewStateMode. But both of them failed. Also tried disabling the cacheability for the page. I know I can clear the textboxes on the page load event. But I am curious to know if there is another way to do this.

View 7 Replies

Clear A DropDownList From Code Behind?

Sep 1, 2010

I want to clear the value of DropDownList from codebehind and i have found following

solution.

[Code]....

View 3 Replies

State Management :: Clear Back Button To Force A Postback?

Sep 18, 2010

I am using asp.net 3.5 and use master pages for most of the website. I need to make sure that users after they logout are not able to use the back button to see in cache data.

View 4 Replies

Web Forms :: Closing User Control - Validator Does Not Clear In Firefox Or But Clear In IE?

Oct 27, 2010

I have create user wizard control and i put validation control for all field but when i close user control that validators dint clear in firefox or but clear in IE

View 3 Replies

AJAX :: Clear The Textbox And Dropdownlist Using A Button After Displaying Data On The Listbox

Jan 27, 2011

I have one dropdownlist and textbox which is databinded and will display retrieved data on a listbox, i wanted to clear the textbox and dropdownlist using a button after displaying data on the listbox.

View 2 Replies

Web Forms :: DropDownList Not Keeping Last Value On PostBack?

Apr 6, 2010

This would be a simple one for me if I was binding this dynamically. I don't think it's necessary to have a code behind for only 4 or so values. Anyways here is my ddl.

[Code]....

The problem is that when a user selects a value and it postbacks my ddl resets to the first value. How do I prevent this?

View 8 Replies

Web Forms :: Five Dropdownlist - How To Avoid Postback

Aug 3, 2010

I have 5 dropdpwnlist in asp.net page.. the 5th dropdwpnlist will show data based on 4th dropdownlist. and 4th dropdwpnlist will show data based on 3rd dropdownlist. and 3rd dropdwpnlist will show data based on 2nd dropdownlist. and 2th dropdwpnlist will show data based on 1st dropdownlist... All dropdownlist has auto postback=true.. so it cause postaback each time.. i want to avoid postback coz it refresh all page again and again and shows data.. coz my aplication is in hosting server..

View 5 Replies

Web Forms :: How To Keep The Colour In Dropdownlist After Postback

Nov 12, 2010

I created a dropdwonlist and add colours to the items. But the colours will lose after the postback. After googled, I knew it is because the attributes specified for the dropdownlist were not saved in ViewState and also found the code to Overriding SaveViewState() and LoadViewState(object) from [URL]

But after I copy the code to my web application to create a new class, there are so many error massages. I have spend two days to find the solution, without much success.

View 12 Replies

Web Forms :: Reset DropDownList After PostBack

Apr 1, 2010

I have a situation where i want to postback and redirect the user to the diffterent page wherever the user selects something from dropdown list. If the user presses the back button the in the browser the dropdownlist should be in the default state. i have already tried this code

protected void ddl_SelectedIndexChanged(object sender,Eventargs e)
{
int selecteditem = int.Parse(ddl4.SelectedItem.Value.ToString());
ddl.ClearSelection(
ddl.Dispose();
//Even tried ddl.selectedindex = -1 ;
//dosome postback i.e redirecting the user depeneding upon the value in selecteditem
}

View 8 Replies

Web Forms :: Expand DropDownList After Postback?

Mar 1, 2011

I would like to expand dropdownlist after onfocus postback. There is some code that runs when OnFocus is fired off then it needs to stay expanded so the user can select an item from dropdownlist. Currently it expands and contracts real fast when user clicks the dropdownlist, then the user has to click it again to select an item.

View 2 Replies

Web Forms :: Dropdownlist Not Refreshing After Postback?

May 10, 2010

I am having trouble with a dropdownlist and it's values not getting updated after postbacks.

Situation: I have an ASPX page that contains 2 user controls (UC1 and UC2). When the page first loads, controls on both UCs are set properly. My problem comes from the fact that when a dropdownlist on UC1 is changed, I need to reload a dropdownlist on UC2 (based on
the new value). I am raising an event from UC1 to the parent page when the dropdownlist value is changed and inside this method I am telling UC2 to reload it's dropdownlist based on the new value. When stepping through the sequence of events using the debugger, the values in the datatables and dropdownlists (item count) are 100% correct but after running through the logic, the dropdownlist on the page still has it's old values.

The initial values for the dropdownlist in UC2 are populated in Page_Load of the ASPX page, and nothing is done to the dropdownlist in Page_Load (!Page.Postback) of either the ASPX page or UC2. The only way I would like the values to change is when the event from UC1 is raised back to the page.

I have found a couple of other forum posts out there that had the same problem but I've tried those resolutions and nothing has worked. In the following examples, the value dt is the 'new' datatable that I wish to bind to the dropdown.I read that before rebinding the dropdownlist, that the Items need to be cleared and the SelectedValue should be set to NULL:

this.dropdownlist.DataSource = dt;

this.dropdownlist.Items.Clear();

this.dropdownlist.SelectedValue =[code]....

View 3 Replies

Web Forms :: DropDownList Doesn't Postback?

Sep 22, 2010

I've created two datasources, one that gets a list of categories and it's id's and the other one get subcategories and it's id's. The categories are presented in a DropDownList and the subcategories in a ListBox. When choosing a category from the DropDownList the ListBox presents the subcategories of the chosen category. The subcategory datasource is set to get it's value for what category to get from the DropDownList's selected value.

My problem is that when I change the category in the DropDownList the subcategories doesn't update on a postback. Instead I have to press a button on the page that I know performs a postback to get the subcategories to update. What am I doing wrong here? I'm using this method on another page as well and when comparing them I can't find anything different. Any ideas?

View 5 Replies

Web Forms :: Stop PostBack In DropDownList?

Oct 19, 2010

I hve few values in my Drop Down List

[Code]....

i want when ever i Select the Value-"Select " it should not postback it PostBack me when ever i Select the value ("Select Again")

can't use Ajax right now other alternative would be javascript

View 5 Replies

Web Forms :: How To Maintain DropDownList Styling After Postback

Feb 25, 2010

Using VS2008, .NET 3.5, and C#. The page contains (among other things) a dropdownlist and an objectdatasource. The Page_Load event fires the objectdatasource's Select event. The Selected event iterates through the returned datatable, feed each row into a ListItem, checks to see if a certain column is True or False and, if true, changes the styling for that row to color:red. Finally, the listitem is bound to the dropdownlist. The end users sees all of the dropdownlist items that are false in black and the items that are true are in red. Works perfectly. However, as soon as any item is selected, the page does a postback and the font colors in the dropdownlist revert to the default black. Is there a way, other than rerunning the method that iterates through table and creates the listitems, of maintaining the coloration of the items? Is there a ViewState setting or something?

Here is the dropdownlist and objectdatasource's Selected event:

[Code]....

[Code]....

View 3 Replies

Web Forms :: Dropdownlist Onchange With Confirm Does Not Postback

Mar 10, 2010

i have dropdownlist with autopostback=true,

written onchange event for confirm popup and SelectedIndexChanged event also exists.

req is if confirm returns true then only postback should happen else not

instead its not atall doing postback whether it returns true or false.

i managed to get it work by forcing postback by using __doPostback()

View 13 Replies

Web Forms :: Unable To Get Dropdownlist Control Value At Postback?

Feb 23, 2010

I have 2 - DropdownList controls, which i am filling at severside when page loads. After the user selection in DropdownList1, i am changing the contents in DropdownList2 values. This validation (i.e. changing the contents of Dropdownlist2 values) am doing in Javascript Clientside. But on postback i am not getting the values in DropdownList2. When i say "DropdownList2.Items.Count;" getting "0". I tried to put the contents of DropdownList2 in ViewState on pageload. But i am getting Serialization error at runtime "Viewstate["PersistValues"] = DropdownList2;". I am using html input hidden control to pass the values from server side to clientside for my validation. Now, to meet this requirement i am Binding the DropdownList2 at postback again with first DropdownList1's selected index (This is repeat of logic which i have done in Clientside).

View 5 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved