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


Similar Messages:

Web Forms :: Reset GridView Display After Postback?

Mar 3, 2011

I have an application where the user scrolls down through a grid and clicks a SELECT button to populate some textboxes based on the content of the grid. On the return from the postback the selected row is out of sight because the grid comes back reset to the top within the scroll window.

Is it possible to have the postback return with the highlighted selected row visible rather than forcing the user to scroll back down to find the selection?

View 2 Replies

Web Forms :: How To Reset All The Panel To Its Original Status After Several PostBack

May 19, 2010

I have a panel that users are filling blanks in it.

In this process, several post back will be fired and controls like labels, dropdownlists will change their values, nested panels will change their visible.

Now I wish to know how I can reset these changes when user submit the form.

Like

protected void btnSubmit_Click(object sender, EventArgs e)
{
Panel1.Controls.Reset();
//there is no such a method of Panel
}

As a clarification, I still need to use some of the value in the btnSubmit_Click and display some submit info based on these values. So I *cannot* use Response.Redirect().

View 7 Replies

AJAX :: Scrollbar Is Reset By Updatepanel Postback - How To Fix It

Jul 20, 2010

I have an Usercontrol which has a update panel that being postback by a timer, and it is nested in a parent page which has its own update panel. Every time that the update panel in UserControl cause a postback to server my main page's scrollbar being reset to top or buttom of the page. I enabled viewstate of parent page but nothing, and when enable parent page's MaintainScrollPOsitionOnPOstback it cause a problem for Usercontrol updatepanel postback !

View 2 Replies

AJAX :: Postback Does Not Reset Meta Refresh Tag?

Feb 25, 2010

I have a kiosk application that uses master pages. There is a refresh meta-tag on the master page (or I can add it programmatically using Page.Header.Controls.add(metaTag), it makes no difference for my problem). When the user does not interact with the aplication it should return to the default page. But when the user does react using async postbacks only a partial postback is performed which does not reset the html meta refresh header, so it just keeps on ticking and after x seconds the page redirects to the default page. How can I avoid this from happening. The meta-tag can not be in the updatepanel so even though I can manipulate it from the code-behind when the async postback happens, any changes I make (for example sometimes when the user makes a mistake he should be redirected to a clean version of the page he is currently on after showing a modal message, so I have to change the url of the meta-tag content to no longer use the default page, but the current page) are not implemented.So the main question is, how can I manipulate (or reset in case of refresh meta tag) meta-tags in an async postback ?

View 2 Replies

C# - Membership Controls Reset Password Postback Error?

Mar 11, 2011

I have written a simple jQuery dialog box that will appear in an asp panel if the logged in user has not reset their password in the last 90 days. This is working great, however when the user types in their password and presses submit to insert the new password into the database, the parent page is posting back before the click event is fired on the user control.

Here is how it is set up:

default.aspx
<asp:Panel ID="pnlTest" runat="server" Visible="false">
<div id="dialog" title="Password must be reset">
<cms:ResetPassword runat="server" ID="reset" />

[Code]....

Whenever I click the button to change the password, the default page is calling a postback and it is blanking out the text that was input to change the password, so when the click function gets called the strings come through as "" and it throws an error.

View 1 Replies

Javascript - Add Reset To Defaults Button To Asp Form But Avoid Postback

Sep 6, 2010

I have a couple of fields on a form that will be populated with default values. I would like to put a button that will allow me to reset those fields to their default values if they have been modified. However I would like to avoid the postback so that I don't have data being sent to the database. Is it possible to add a javascript hook such that when that button is pressed I can pull the default values and populate those fields in javascript?

View 1 Replies

AJAX :: Avoid Password Reset Problem On Webforms During Postback?

Feb 19, 2011

I have a Username and Password field on webform and a Submit button.Username ia validated through database on button click.Each time when i click on submit button and if Username already exist then my password gets to be removed due to postback.Please give me some solution so that when i just defocus my username field it will automatically check and display message if it exists.Please donot give Textbox ontextchanged event with update panel in conditional update mode because it will not work for me because i am using devexpress tools on my webforms.

View 1 Replies

C# - DropDownList Items Are Reset On SelectedIndexChanged?

Sep 17, 2010

I have a cascading dropdown list on my page. The first dropdown contains a list of events. The second dropdown contains a list of attendees. When an event is selected, an AJAX call is made to get the list of attendees for that event, and populate the second dropdown.

My problem is that for the attendees dropdown, I want the user to be redirected to a URL on the SelectedIndexChanged event, with the selected value in the query string. But on the SelectedIndexChanged event, all the items in the second dropdown are reset. Here's my code:

<script type="text/javascript" language="javascript">

$(document).ready(function()
{
$('#<%= ddlEvents.ClientID %>').change(function()
{
$.ajax({

[Code]....

When the SelectedIndexChanged event is hit, ddlAttendees is empty.

Does anyone know how I can keep the items in ddlAttendees?

View 2 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

DropdownList Reset In Updatepanel On Submit Button?

Oct 7, 2010

I have a dropdown list which is in updatepanel. I have to fill that dropdown on a client event through javascript which calls __dopostback of the updatepanel and calls its load event.

Problem is that when i submit the form updatepanel_Load event also execute again and it again reset the DropDownLIst which causes the loss of selectedValue in Dropdown.

<asp:UpdatePanel ID="UpdatePanel3" runat="server" OnLoad="UpdatePanel3_Load" UpdateMode="Conditional">

<ContentTemplate>


<asp:DropDownList ID="ddlItems" runat="server" CssClass="dropdown">
</asp:DropDownList>

</ContentTemplate>
</asp:UpdatePanel>

On page Load this dropdown is Empty .... no funtion to fill it.Now the problem is when ever I Fill the Dropdown throught Load of UPatepanel, that UPdatepanel Load event also execute when I submit my page. Actually the solution of javascript is due to a table and on Selection of the table row item it Fills the DropDownList from __dopostback of my updatepanel.

I have button which opens a popup window and that popup window contains a table, when client select some item from that table and close that popup window then I fill my dropdown (in parent or opener page through Ajax, Updatepanel's Load) as further selction option. so dropdown databind is dependent on that tables input.

View 2 Replies

AJAX :: Masked Edit Extender - Date 01/01/0001 Reset To 01/01/1910 On Postback

Jul 28, 2010

I have a masked edit extender extending a text box. I enter the date 01/01/0001 then change a selection on a drop down list inside the same update panel with the autopostback property set to true. The date is changed to 01/01/1910.

[Code]....

View 7 Replies

Data Controls :: Reset All DropDownLists In GridView When DropDownList Of First Row Changed

Mar 9, 2013

<asp:DropDownList ID="ddlday" Width="100px" runat="server" CssClass="iselect" Autopostback="True"
AppendDataBoundItems ="true">
<asp:ListItem Text="--Select--" Value="0" />
<asp:ListItem Text="Full" Value="1" Selected="True" />
<asp:ListItem Text="Half" Value="2" />
</asp:DropDownList>

I have a dropdown in gridview. I bind the gridview after not ispostback condition. Now if i select drodown lsit value "Full" from the first row of gridview i need all other rows of dropdown in gridview to be selected "full" programtically and after that if the user wants to change other row dropdown to "half" then he can change it.

View 1 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 :: 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 :: 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

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

Web Forms :: Dropdownlist Selection Changes To First Item On Postback

Oct 19, 2010

I have been having some trouble with dropdown lists reverting back to selecting the initial item in the list after a postback once a selection has been made from the dropdown list. I have read up on this and found out that a "if not ispostback then" is required.This works fine when I add in all the items in the dropdown list manually like:

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
ddl1.Items.Add("Select...") [code]....

However, I have over 250 items and so it is far more efficient for me to load then in by using part of a multidimensional array which is created from a text file - Definitive database.txt. I have been using the following code to do so:

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
'loads the definitive database array[code]...

This loads all the items into the dropdown list perfectly, but now every time a selection is made, it reverts back to the inital item on postback even though i have included the "if not ispostback then" part.

View 3 Replies







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