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


Similar Messages:

Web Forms :: How To Disable Postback On Expand/collapse

Jun 22, 2010

can we disable postback on expand/collapse of treeview node while allowing post back on SelectedNodeChanged

View 2 Replies

C# - Force .net Dropdownlist To Expand?

Aug 27, 2010

I have an ASP.NET data bound dropdownlist which is populated based on the contents of a textbox. After it is populated I would like to expand the dropdownlist automatically, so that the user realizes that a choice needs to be made and doesn't need to click on the dropdown to expand it. There doesn't seem to be a property or method do do this.

EDIT: After trying out Ed B's example, I am still stuck. The id of my ddl is 'ctl00_ContentPlaceHolder9_ddlContact'. If I put the following in the onclick event of a button, it works fine, the dropdown expands nicely:

document.getElementById('ctl00_ContentPlaceHolder9_ddlContact').size=10;

However, the following code in the Databound event of the ddl shows the alert but doesn't expand the dropdown:

string script = "<SCRIPT LANGUAGE='JavaScript'> ";
script += "alert('expanding');document.getElementById('ctl00_ContentPlaceHolder9_ddlContact').size=10 </SCRIPT>";
ClientScript.RegisterClientScriptBlock(GetType(), "Dropdown", script);

View 3 Replies

AJAX :: Collapsible Panel Extender Doesn't Re-expand After Postback?

Jun 29, 2010

Here is my code. The only problem i am facing is that header panel does not expand after a button in content panel postbacks.

The header panel returns to its original state i.e. collapsed but doe not expand on clicking it.

[Code]....

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

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

Web Forms :: DropDownList Causing Postback On Change

May 9, 2012

I have 1Dropdownlist 1 button and 1 datalist in my page i bind my datalist in Page_load event that show all my product from my DB ... Users  can select their city from DDL click on button and in datalist just show product that are on selected city ...

Problem: when users select PARIS from ddl in datalist show product from selected city and when users want change their city from ddl before their click on button to show that city's product page load again and it show all product again...

I want when users change ddl.selecteditem in datalist show last result of user's selected not the result that i define in page load ... This is my code on page load ...

  protected void Page_Load(object sender, EventArgs e) {
if (!IsPostBack) {
DDLcity1.Items.Add(new ListItem("select your city", ""));
BindDropDownList(DDLcity1, "Guidcity", "cityname", "ID");
}

View 1 Replies

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

Web Forms :: How To Pass Selected Value Of DropdownList To A User Control On Postback

Feb 25, 2010

I need to create a user control which will be loaded according to the selected value of a dropdownlist. The Dropdownlist is not the part of Control. I want to pass the value of selected value of dropdonwlist to my user control and the user control will load according to the Value. For not postback it work fine. But when the page is postback, that is when i select a item form dorpdownlist, the user control is not loaded.

View 6 Replies

Forms Data Controls :: Dropdownlist Postback Always Select First Item?

Mar 24, 2010

I have 2 dropdownlist controls (ddl1 and ddl2). When I pick an item from ddl1, it will update ddl2. The problem is when I pick an item in ddl2, it always selects the first item in the list. Is it that the ddl2 autopostback causes the first ddl1 to reload and results the ddl2 to be refreshed also? Or I didn't set something correctly?

[Code]...

View 12 Replies

Forms Data Controls :: DropDownList In DataGrid Selected Value Not Being Saved On Postback

Apr 13, 2010

I have a DataGrid that has a dropdown list in an ItemTemplate. Basically, users select a value from the dropdown for each row of the datagrid. When the page is posted back, the selected index of the dropdown list is always reset to 0, and the items are re-bound.

Does anyone know why this might happend? The dropdown items are hardcoded, so there is no external data binding that happens on post back.

View 5 Replies

Forms Data Controls :: DropDownList -- SelectedIndexChanged Fires Every Postback Whether Changed Or Not?

May 12, 2010

<asp:DropDownList ID="cboItemsPerPage" runat="server" CssClass="standardComboBox" AutoPostBack="true" EnableViewState="true" OnSelectedIndexChanged="cboItemsPerPage_SelectedIndexChanged">
<asp:ListItem Value="1" Text="1" />

[URL]Initially if I make a selection it will automatically post back and firecboItemsPerPage_SelectedIndexChanged. If I then post back by clicking one of the other buttons on the page, cboItemsPerPage_SelectedIndexChanged will continue to fire, despite the fact that the value has not been changed.I want it to be postback only when selected index is changed, not in every postback

View 3 Replies

Forms Data Controls :: How To Maintain The Selected Item In Dropdownlist (in Template Field) In Gridview After Postback

Mar 25, 2010

i have a gridview which consists of databounds and dropdownlist control. When I press the Add Grid Row Button, it will insert a row. Now my question is, if the user selected an item in dropdownList in the firstrow and the user click the AddGridRowBtn Again which will generate the 2nd row, how would i maintain the selectedItem in the dropdownlist after postback?

Source For Gridview:

[Code]....

Add Row Code

[Code]....

[Code]....

And For Grid Row Created Event

[Code]....

View 5 Replies

C# - Cascading Dropdownlist Without Postback?

Aug 10, 2010

I have a .aspx page having two dropdowns, the data to be loaded in them is usually static(but may change everyday), the first dropdown always displays the main categories and the second dropdown is initially empty.

Now, the requirement is:

As the user selects a category from the first dropdownlist, the second dropdownlist should populate based on the selection just made.

The road-block:

This should be done without a postback. My boss wants something like the drop downs on this page.

So what I gather is, I'd have to retrieve the data from the database on page load event, store it in the cache(or somewhere else?), then use javascript to handle the selectedindexchanged event of the 1st dropdown, use the data from database stored at pageload and populate the second dropdown according to the selected value of first dropdown.

P.S.- I'm a beginner ASP.Net C# programmer and have no knowledge of Javascript.

View 2 Replies







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