.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan
Santhakumar Munuswamy
Fauzul Azmi
Asad Ali
Post New Web Links

Required Validator disappears after autopostback set to true of a dropdownlist

Posted By:      Posted Date: October 12, 2010    Points: 0   Category :WPF
 

My dropdownlist having data from database added with the following item:

DropDownList.Items.Insert(0, new ListItem("Please select", "0"));

My dropdownlist is inside of updatepanel. The autopostback=true is required.

The code is like following:

<asp:DropDownList ID="DropDownList" AppendDataBoundItems="True" runat="server"
                  DataTextField="Description" DataValueField="CommonCodeId" TabIndex="4" 
                    CssClass="drop_red_style1" AutoPostBack="True" CausesValidation="True" 
                     OnSelectedIndexChanged="DropDownList_SelectedIndexChanged">
                </asp:DropDownList>

<asp:RequiredFieldValidator ID="RequiredFieldValidator" runat="server" ControlToValidate="DropDownList"
                    Display="Dynamic" InitialValue="0" SetFocusOnError="true" ValidationGroup="Registration">Required</asp:RequiredFieldValidator>
Please guide me how to keep the required field validator message.




View Complete Post


More Related Resource Links

Required Validator disappears after autopostback set to true of a dropdownlist

  

My dropdownlist having data from database added with the following item:

 

DropDownList.Items.Insert(0, new ListItem("Please select", "0"));

 

My dropdownlist is inside of updatepanel. The autopostback=true is required.

The code is like following:

<asp:DropDownList ID="DropDownList" AppendDataBoundItems="True" runat="server"
DataTextField="Description" DataValueField="CommonCodeId" TabIndex="4"
CssClass="drop_red_style1" AutoPostBack="True" CausesValidation="True"
OnSelectedIndexChanged="DropDownList_SelectedIndexChanged">
</asp:DropDownList>

<asp:RequiredFieldValidator ID="RequiredFieldValidator" runat="server" ControlToValidate="DropDownList"
Display="Dynamic" InitialValue="0" SetFocusOnError="true" ValidationGroup="Registration">Required</asp:RequiredFieldValidator>
Please guide me how to keep the required fie

Dropdownlist not firing SelectedIndexChanged on first item with autopostback true

  
Hi: Has anyone ever found a work around for the well documented and well known bug, the dropdownlist bug? Specifically where the SelectedIndexChange event does not fire on the first listitem, althought both autopostback and enableviewstate are true? In other words, if the first three items in the dropdownlist are red, blue, green, if you select green, the SelectedIndexChanged will fire, but if you then select red, the first item in the ddl, the event will not fire. All listitems will fire the SelectedIndexChanged event, except for the very first listitem. The HACK has always been to include a dummy item as the first list time like"Select a Color" to get around the first item bug. I have got a situation where I cannot use that hack. Ideas?  TIA, Bill  

Dropdownlist AutoPostBack="true" NOT Firing in IPhone

  

Hi everyone,

This is really weird...I have a ASP.NET page for mobile view.

On that page I have this part:

<td><asp:DropDownList ID="DropDownLocation" runat="server" AutoPostBack="true" OnSelectedIndexChanged="test" 
                            appenddatabounditems="True" style=" font-size:large; vertical-align:middle;" Width="170px">
                    <asp:ListItem value="Houston">Houston</asp:ListItem>
                    <asp:ListItem value="El Paso">El Paso</asp:ListItem>
                    <asp:ListItem value="Austin">Austin</asp:ListItem>
                    <asp:ListItem value="Boise">Boise</asp:ListItem>
                    <asp:ListItem value="Washington">Washington</asp:ListItem>
            </asp:DropDownList>

While testing this on normal computer using IE7 IE8 it fires the AutoPostBack Control.

BUT TESTING IN IPHONE THIS DOES NOT FIRES....

ALSO THE DISPLAY IS WIERD BECAUSE A SEPARATE BOX APPEARS AT THE BOTTOM TO SELECT THE LIST.

What am I doing wrong?

Thank you in advance!

 

 


attachment disappears when evaluating the required field in sharepoint list

  
hi all, i have a sharepoint list with soem required fields . when i do the attachement and say ok without entering the required fields in the page . the page refreshes and prompts me to enter the required fields. but the attachemnt disappears. i need to re attach the files aggain.. wats the fix for this ?jayaraja

AJAX ComboBox - required field validator

  
Hi All, I want to put validation on a combobox to ensure user selects/enters a value. I've tried using a the standard required field validator which doesn't work. So I would like to do the validation using javascript/jquery. Not sure how to approach. When I look at how the combo box is rendered, it appears as a unordered html list. There is also a hidden field but this always seems to be set to 0. So is it possible to do this validation client side. I've read so many posts about this but I havn't got an answer yet. Am I on the wrong path here? Any ideas? Thanks

LoginView, DropDownList, Cookie, AutoPostBack Conundrum

  
OK, I am at a complete loss. Users for my site can have many stores to configure under their one user account. When they login I have the app generate a cookie for each store and hold all the stores basic information. For each cookie I then generate a list item in a drop down list. I can get the list to generate just fine and all of the pages that reference the list get the information fine. When I change the list to a different item however, and the page posts back my first LoginView is set to LoggedInTemplate while my navigation loginview (in site.maser like the first one) and my content loginview (in the actual page) come back in AnonymousTemplate, even though the user is authenticated. I can either do a response.redirect or physically refresh the page and all loginviews are in LoggedInTemplate again. The problem is though that I lost all of the postback data so I can essentially only view information on the first item in the dropdownlist. Now, I am new to asp.net authentication, and while I feel that I am starting to get the hang of it, there is a very good chance that I am doing something wrong. I have all the authentication working correctly and except for this postback issue. I can login, navigate through pages that aren't accessible without being authenticated and I can logout without issue. If anyone has any suggestions it would be gr

how to apply styles on the message displayed by asp.net required field validator control?

  
 Hi,I want to apply styles on the message (i.e. Name field is required) display by the asp.net required field validator control.Styles=border, padding, background-color, font-color, font-weight, img etcAnd I also want highlight the border or asp.net textbox and asp.net dropdown list with which this control is associated.  RequiredFieldValidator does not have style property !Can anyone let me know how can I do this???Regards,Dazy

Stopping Required Field Validator from going to a new line.

  
How can I stop Required Field Validator from going to a new line without using a table?

Getting the headertext of a selected column when autopostback = true

  

Hi All,

I have a grid which is getting bound from a dataset and the autogeneratecolumns prperty is set to true.

Now i have a menu control. And when i select a particular cell, I want to headertext of the cell selected should appear as the text of the menu item.

But because autogeneratecolumns = true, so i gridview.columns.count=0. So not able to get the header text.

The code goes as follows.

If selectedColumnIndex > 4 Then
                menuBSDet.Items(0).ChildItems(menuDetail.RemoveDetValues).Enabled = True
                menuBSDet.Items(0).ChildItems(menuDetail.RemoveDetValues).Text = "Remove " & gvwBSDetails.Columns(selectedColumnIndex).HeaderText
            Else...


 

Can somebody please help?


Problems with AJAX slider and autopostback=true ?

  

I have three AJAX sliders and each has a:

<asp:AsyncPostBackTrigger ControlID="Slider1" EventName="TextChanged" />
<asp:AsyncPostBackTrigger ControlID="Slider2" EventName="TextChanged" />
<asp:AsyncPostBackTrigger ControlID="Slider3" EventName="TextChanged" />


When I do a TextChanged event on slider1 (by dragging the slider, changing the value), the protected void Slider1_TextChanged(object sender, EventArgs e) event FIRES,  however, the TWO other sliders, protected void Slider2_TextChange, and protected void Slider3_TextChange  also FIRES.  What gives?  why do they fire when I am physically only sliding the slider1 across.  The two other sliders values did not change on the webform, yet the event fired.


In order for the event to fire for slider1, I had to insert "Autopostback=true" in the <asp:TextBox ID="Slider1" autopostback="true" OnTextChanged="Slider1_TextChanged">.  For <asp:TextBox2> and <asp:Textbox3> I did not put the autopostback event for now.


thanks!!!


disable required field validator at server side

  

Hi everyone,

my question is very simple. I had read through many post include this: http://blog.anasghanem.com/post/How-to-get-the-readonly-textbox-value-on-the-server-.aspx

I have a calender extender and the date was target to a texbox. This textbox, i had set it to readonly and it is validate by a required field validator. so mean this texbox must have a value inside. my prob is, i bind the textbox to database and if data is NULL or empty i can't save it because the required field validator was validate textbox as empty value at cllient side. If i remove the required field validator everthing fine. But this is not i want. I have try to set the textbox to javascript onCopy,onPaste,onkeyup. but user also can delete and paste into the textbox.

i have think to disable the requried field validtor at server side when data is inserted. Anyone know how?


Required Field Validator and drop down list

  

 I am trying to get the required field validator to work. I have given it an initial value of the first index value in the dropdown list. I is just not working. Will my contrrols residing on a View of a Multiview control effect anything. I am using all drop down lists?


Cascading dropdown not posting back even though autopostback=true?

  

I have the following code:

.aspx
<asp:DropDownList ID="ddlCountries" AutoPostBack="true" runat="server">
</asp:DropDownList>
<cc1:cascadingdropdown ID="cddCountries" runat="server" Category="Country" Enabled="True" LoadingText="loading" PromptText="choose country"
    ServiceMethod="GetCountries" ServicePath="geolocation.asmx" TargetControlID="ddlCountries">
</cc1:cascadingdropdown>


code behind
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    ShowSearchResults()
End Sub

Private Sub ShowSearchResults()

End Sub


Why is the ShowSearchResults method not called when I change a value in the ddlCountries dropdown, even though I have autopostback="true" on it.


Disabling ViewState for DropDownList and using AutoPostback with SelectedIndexChanged

  

The sites I mantain are using way too much ViewState and I'd like to reduce that so the size of the page is reduced.  I've done a lot to remedy this but I have an issue relating to DropDown lists that use AutoPostbacks.

I have a dropdown list with a lot of list items and a good part of the ViewState usage is to hold the list item data.  If I disable ViewState and set the AutoPostBack property to true, the page will post back and in the page load I am trying to repopulate the dropdown list with cached data.  However, it seems that the SelectedIndexChanged event doesn't fire when EnableViewState="false".

Is it possible to make this work without enabling ViewState for the drodown list?


How to use required field validator along with ajax tool kit editor control?

  

Hi,

How to use required field validator along with ajax toolkit editor control?


DropDownList Disappears?

  

Hi,

I am calling JQuery in code behind (button click event) as follows:

...

msg = "csscody.error('<h1>Error</h1><br><p>There is an Error Occurred while manual request entry process</p>')"
ScriptManager.RegisterStartupScript(Button11, Button11.GetType, "alertscript", msg, True)

The problem is when this alert box appears (csscody.error) the dropdownlist boxes on this div tag (overlay) disappears.Here is the
html:
<div class="modal2" id="prompt2">
        <

jQuery: Styling DropDownList Alternating Items (Rows)

  
In the following example, I will show how you can style any asp:dropdownlist very easily.

The example demonstrates how you can change alternating row items background color, using the fadeTo() to add a nice touch in the dropdownlist. You can change alt rows with a couple lines.
Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend