Web Forms :: DropDownList Attributes Lost On Post Back?

Feb 13, 2010

I have color attributes set to some items in dropdownlist on Page Load.

Dim li As New ListItem("heading" , "0"))
li.Attributes.Add("style", "font-weight:bold")

however, it loses after Post Back, ie., on SelectedIndexChanged event.

View 1 Replies

Similar Messages:

Web Forms :: GridView's CSS Lost After Ajax Post Back?

Feb 24, 2010

I have a css file which is external registered in Master Page which contents the following code :

background-color: #def2fd;
font-weight: bold;

The Item is applied for GridViewRow. This GridView is in a UpdatePanel, when I click a button to do a Ajax Post Back the CSS applied for the GridViewRow is useless (IE 6 only).

View 6 Replies

Attributes Clear On Post Back?

Jan 14, 2010

I am using Attributes.Add("style","color:green") with some checkboxlists and radiobuttonlists. When I click one of the checkboxes and I do the autopostback the attributes clear out. So I would think someone already has a sub to fix this. Something like:

SaveAttributes(checkboxlist1) or SaveAttributes() 'which would loop though all controls and save the state.

and then on pageload it would have

LoadAttributes(checkboxlist1) or LoadAttributes() 'which would loop through all controls and restore the state.

View 6 Replies

Data Of Text Box Is Lost After Partial Post Back?

Mar 18, 2011

I have used update panel and in that update panel I have kept ASP Table control in which I am creating rows dynamically which in turn contains 1 dropdown lists and 3 text boxes. My problem is that after partial postback text boxes and dropdown list are found but text property of text boxes is showing empty and dropdown list's selected value is set to the first record in that box. I have also stored entire table in session and retrieve it in(!isPostBack) condition at page_load event.

part of my .aspx page is as below


I want to add one row on every addRowTbn click event there by retaining previous rows.

View 1 Replies

C# - Post Back Occurs JavaScript Listbox Items Lost?

Jan 6, 2011

i have 10 list boxes in my aspx page for all 10 list boxes same function is using for some buttons i want to add listbox data to grid can you java script code shown below


i tried a javascript above code to move items between listbox using html input button problem when i trying to save listbox.items.count giving 0 can anyone tell me why this happening and also when post back occurs listbox items lost.

View 1 Replies

Object Reference Lost After Post Back - __EVENTTARGET GridVieww And LinkButton

May 30, 2010

I have a GridView and a LinkButton control. I click the LinkButton control and loose the object reference to both objects after post back. I want to be able to get the command arguments from the link button and then be able to get a reference to the gridview control to determine which page index to set the gridview. I have been able to get the __EventTarget property to reference the object that was called but Im not able to reference that object.



View 6 Replies

Web Forms :: How To Retrieve Fileupload Value In Dropdownlist Post Back

Dec 6, 2010

I have a fileupload control in a web page. I upload one file to the fileupload control. I am having the path like c://images/image.jpg. But if change dropdown value,then i am losing the value in the fileupload control. How to get back the value?

View 32 Replies

Web Forms :: Required Field Validator Disappears On Dropdownlist Post Back

Apr 15, 2010

I populate two dropdownlist in asp.net. Both are assigned to a required field validator.

The codebehind is as below


the designer code is as below


Now what happens is, when i choose a field from the dropdown and once again when i choose the "-- Select--", the validator appears and then disappears.Where am I going wrong?Why doesnt the validator stay?RegardsHema

View 3 Replies

Web Form And Ajax Data Lost On Post Back - Finding Possible Cause / Ajax Or Changing Visible Property

Sep 15, 2010

I have two Repeater controls, each hosted in a user control. Both user controls are contained in the same aspx page. Only one User Control is visible at any one time. The repeaters are comprised of checkboxes, and text boxes for user input.

The aspx page is configured with an Ajax ScriptManager; and contains several Ajax UpdatePanels. These UpdatePanels result in partial page post backs when text is changed in a textbox control in controls on the aspx page (this is not the behaviour for the Repeaters in the User Controls). Through use of several AsyncPostBackTriggers, various controls contained in the other UpdatePanels on the page have their content refreshed in response to the partial page post backs they are configured be notified about.

Depending on a radio button group selection, I set the visible property to true or false - as appropriate for the User control containing a repeater control. The Repeater control is then populated with data using databinding. All of this works.

However, when the Submit button is clicked, the Repeater control contains no data.

Given that I am not dynamically adding the Controls containing the Repeater controls (but using Visible true / false). I would have thought that the State of the fields and the data in the visible control would be preserved during the post back.

The User Controls are contained within the UpdatePanel that contains the Submit Button.

I have explicitly Enabled View state without any effect.

Am I correct in assuming that I should not have to do any explicit handling of data changes the user makes (via client side script and manipulation of an Data Structure Representing the Repeater Data); and the View State should maintain the data I need to access on the server when submitted?

I do not believe that it is the User Control visible state changes that are causing the issue because when the page is initially loaded on of the User controls is populated with dummy rows (so it displays).

I am suspicious that because the visible state of the controls is changed during partial page post back, that the Page View State ends up with no knowledge of the User Control and therefore cannot track its data (or changes).

View 1 Replies

Web Forms :: Loading On Post Back Like Facebook On Every Post Back Request

Nov 30, 2010

I have four textbox and a button in my page. After filling the textbox. When the user click save button. A loading image should be displayed. User should not feel that the page is postback to the server,Some thing like in facebook loading image.

View 5 Replies

Dropdownlist In Asp.net Changes The Value After Post Back?

Nov 20, 2010

i have tow dropdownlists in formview when i select from the first dropdownlist i take the value and postback to the same page with this line response.redirect("addtabs.aspx?SECID="+dropdownlist1.selected value.tostring())and thi second dropdownlist take th SECID and fill it self with sqldatasource with this parameter every thing okbut when post back the first dropdownlist doesn't select my choise but select the first item in it how can i make it still select my selection.

View 1 Replies

C# - Required Field Validator Disappears On Dropdownlist Post Back?

Apr 14, 2010

I populate two dropdownlist in asp.net. Both are assigned to a required field validator.

The codebehind is as below

if (!Page.IsPostBack)
DataTable dt = new DataTable();


Now what happens is when I choose a field, and then once again go and choose"-- Select--", the validator appears and disappears.

Why doesnt the validator stay? Where am I going wrong?

View 1 Replies

C# - Using A Timer Post Back, Which Controller To Use That Doesn't Post Back To Server?

Jul 14, 2010

Being new to ASP.NET I have run into trouble building my own Whack-a-mole program. I think my problem comes from using Buttons, which by themselves send post backs to the server, making the software unusable. The looks are in place, making new buttons show up in the grid, in different places by random. However, when a button is pushed - the score doesn't change (which I feel is strange).

Not so strange is that the Button doesn't work since it sends post back to the server - reloading the UpdatePanel. I think I should use a different controller like the CheckBox and style it hard using CSS (which isn't a problem). Is this the correct way to go, or should I make use of JavaScript AJAX instead?

Note to self: This technique shouldn't be used in a public application since it put too much unwanted pressure on the web server.


View 1 Replies

AJAX :: Display Loader Image On DropDownList Auto Post Back In Update Panel

May 4, 2014

How to display wait image when data is being populate into one drop down based on selection of another dropdown inside update panel....

View 1 Replies

Web Forms :: Scroll Back To Drop Down List After Auto Post Back In Code Behind?

Feb 22, 2011

Using Vb.Net 2003 Asp.Net 1.1

I have a dynamic data bound drop down list, when the user selects thier selected item I have to use the autopostback feature.

Problem is: when the page comes back it is at the top of the page not where i have the control.

I don't really need it to focus back on the dropdownlist but to scroll to it, I want to do it in the code behind.

Any "New" ways to do it, I mean new as in code from like 2010 instead of old code from the early days.

I really don't want to use Page.Register new Script...... code if I can avoid it.

What would be cool is a ScrollToControl() Function for my code behind that worked but didn't register script.

View 3 Replies

C# - A Generic DropDown Implemented By ControlBuilder Lost All Attributes

Sep 10, 2010

Here I have a code using ControlBuilder to make DropDown control generic.

public class EnumDropDown : DropDownList {
private string _enumType;
private bool _allowEmpty;
public string EnumType {
get { return _EnumType; }
set { _EnumType = value; }
public bool AllowEmpty {
get { return _allowEmpty; }
set { _allowEmpty= value; }
public class EnumDropDown<T> : EnumDropDown where T : struct {
public EnumDropDown() {
if (AllowEmpty) this.Items.Add(new ListItem("", "__EMPTY__"));
foreach (string name in Enum.GetNames(typeof(T))) {
public new T SelectedValue {
get {
if (IsEmpty) throw new NullReferenceException();
return (T)Enum.Parse(typeof(T), base.SelectedValue, true);
set { base.SelectedValue = Enum.GetName(typeof(T), value); }
public bool IsEmpty {
get {
return base.SelectedValue == "__EMPTY__";
set { base.SelectedValue = Enum.GetName(typeof(T), value); }
public class EnumDropDownControlBuilder : ControlBuilder {
public override void Init(TemplateParser parser, ControlBuilder parentBuilder, Type type, string tagName, string id, IDictionary attribs) {
string enumTypeName = (string)attribs["EnumType"];
Type enumType = Type.GetType(enumTypeName);
if (enumType == null) {
throw new Exception(string.Format("{0} cannot be found or is not an enumeration", enumTypeName));
Type dropDownType = typeof(EnumDropDown<>).MakeGenericType(enumType);
base.Init(parser, parentBuilder, dropDownType, tagName, id, attribs);

Sorry the program is too long to read cheerfully. The question is, although I defined property EnumType, AllowEmpty in class EnumDropDown. Since the real object created by ControlBuilder is EnumDropDown, values of EnumType, AllowEmpty are always null and false in control object. All attributes set in .aspx will be lost! I can read attribute values of source tag in ControlBuilder. But I have no any idea how can I copy the attributes to the generic control object.

View 1 Replies

Web Forms :: Post-Back, Not A Post-back?

Feb 9, 2011

I have a very odd and disconcerning problem. Just recently a page where I have 1 textbox and a buttoon has ceased to work.

When I look at the post coming into the PageLoad, the pageType is "POST", but the Page.IsPostBack is false!! and the textbox (which had content) is empty.

I have stripped all AJAX script out, so I have a very vanilla page (in a master page) being served.

The pages is


The page is "POST", but isPostback is false[Code]....


View 1 Replies

AJAX :: Difference In Asynchronise Post Back Trigger And Post Back Trigger?

Jul 15, 2010

I searched google and found asynchronise post back trigger is used if we want update panel to post back on some event of control if it is out side the update panel. Than what is purpose of post back trigger ?

View 2 Replies

Web Forms :: A Post From Web Form Got Lost. How To Track?

May 7, 2010

I work on a HR application for Internal people.One of my staff member is caliming that he applied for a job, but we do not have any entry in the database for applicants and no error in Log4net.

The staff member calims that he clicked on the Apply Button. And when we checked the IIS log we found one entry by that user in the IIS event viewer. Now how to determine if the person actaully clicked the apply now button or not.This is a serous issue for us as he is very upset as the Advertising for that position is taken off and he cannot apply now.

How to investigate? Also does IIS logs all POSTS and GET Requests?ur system Admin passed me an error log from the event viewer.Which is something like this:

2010-05-05 00:28:57 POST /HROnline/Recruitment/Apply.aspx rk=579&pid=0 8600 INTERNALMIISNY Mozilla/4.0+(compatible;+MSIE+7.0;+Windows+NT+5.1;+Trident/4.0;+.NET+CLR+2.0.50727;+.NET+CLR+3.0.4506.2152;+.NET+CLR+3.5.30729


View 4 Replies

Web Forms :: Adding Attributes To Dropdownlist From Codebehind

Jan 27, 2011

I have a dropdown list where I need more than just a bound value and a display value. I am using this in the page load event to add a custom attribute:


I'm actually looping through a sqldatareader for a list of employees, but for simplicity just consider the single option added above. When I go to check the attribute EmpNum for the selected option, I am getting "null":


Now the really weird part...If I add an option in the HTML source identical to the one that gets added in the codebehind, the javascript function works for that row, but not the row added from codebehind. Here is the rendered HTML for the SELECT:


If I select the 1st record (added from HTML source at design time) the alert says "12345". If I select the 2nd record, the alert says "null". I CAN get the value ("999-99-9999") and the displayed text ("John Doe") for either record, just not the EmpNum attribute, even though the HTML is exactly the same. I am completely stumped on this one.

View 6 Replies

Visual Studio :: Lost Search Box , How To Get It Back?

Jan 6, 2010

I am using vs team edition 2008 and i just totally lost search box from menu bar. how to get it back..

View 2 Replies

Web Forms :: Selected Value Of DropDownList Getting Lost When Binding With XML

Jun 11, 2012

i am loading xml file from url and storing data into my database.i am binding that data with my dropdownlist bt the problem is wheneverr i select any option from ddl...by defaulst it takes the always takes first selected index...i.e value at the zeroth index value.....i really don't know what exactly the problem either the problem is with dropdown or the way i am loading xml file and binding it to dropdown.....below is my cs code.

protected void Page_Load(object sender, EventArgs e)
if (!IsPostBack)


View 1 Replies

Web Forms :: How To Get Post Back Value From Fields

Dec 30, 2010

Beginner question:

I'm not sure if this is specific to Telerik's plug-in I'm trying to use or if it's a 'generic thing' I'm doing wrong ?

I have a RadTextBox:

<telerik:RadTextBox ID="RadTextBox1" Runat="server" name="nameTest"/>

And I have an ASP button that run this code:
Dim a As String = Request.Form("nameTest")
Dim b As String = Request.Form("RadTextBox1")

Both a and b always remain null.

- How do I get postback values from Rad/components ?
- How do I get postback values from Rad/components when they are in user control ?

View 6 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 :: DropDownList Selected Value Getting Lost When AutoPostBack Is True

May 7, 2015

Am using DropDown list. Whenever Autopostback is true it selecting first value of dropdown list...

View 1 Replies

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