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

Top 5 Contributors of the Month
Post New Web Links

RegularExpressionValidator regarding on the radiobutton

Posted By:      Posted Date: September 02, 2010    Points: 0   Category :ASP.Net
I have RadioButton1, RadioButton2, TextBox1, TextBox2 and Button1This code for TextBox1:<asp:RegularExpressionValidator ID="RegularExpressionValidator3" ValidationExpression="^[0-9]{3}$" runat="server" ControlToValidate="TextBox1"  ErrorMessage="Vnesite!"                 ValidationGroup="ErrormessageValidationGroup"  Display="Dynamic"> <asp:Image ID="Image5" runat="server" ImageUrl="~/Images/warning.png" ImageAlign="TextTop" /></asp:RegularExpressionValidator>This code for TextBox2: <asp:RegularExpressionValidator ID="RegularExpressionValidator3" ValidationExpression="^[0-9]{3}$" runat="server" ControlToValidate="TextBox2"  ErrorMessage="Vnesite!"                  ValidationGroup="ErrormessageValidationGroup"  Display="Dynamic"> <asp:Image ID="Image5" runat="server" ImageUrl="~/Images/warning.png" ImageAlign="TextTop" /></asp:RegularExpressionValidator>I want to "Button1" writes:If RadioButton1 = True to use the first code ... ControlToValidate=

View Complete Post

More Related Resource Links

RadioButton inside GridView, How to get it work as normal

Did you tried before to drag a RadioButton control inside a Gridivew templatefield, and then you attempt to select these RadioButtons , you will notice that the behavior of RadioButton control will be changed and it will work just like the behavior of checkbox control! the user will be able to select more than one radiobutton in the grid!

RadioButton Groups, Table Rows And NamingContainers in asp.net

The RadioButtonList. Very handy for inviting users to select just one item from a list although because of the screen real estate it takes up, used less and less in favour of the DropDownList. In plain HTML, the browser knows to enforce the unique selected value amongst a list of radio buttons because they all have the same value for their name attributes.

RadioButton Groups, Table Rows And NamingContainers

(In which AJAX-enhanced CheckBoxes become more useful than RadioButtons but inheritance saves the day, and a simple RadioButton-derived control establishes the purpose of a control's naming container)

The RadioButtonList. Very handy for inviting users to select just one item from a list although because of the screen real estate it takes up, used less and less in favour of the DropDownList. In plain HTML, the browser knows to enforce the unique selected value amongst a list of radio buttons because they all have the same value for their name attributes.

The radiobutton control

The and Controls
In HTML, radio buttons are used when we need to make multiple sets of choices available, but we want the user to select only one of them. If they click on a second selection after making a first, the first selection is removed and replaced by the second. Radio buttons are implemented in HTML using the tag, and setting the type attribute to radio. Every radio button on the page needs to have its own tag. Each radio button within a particular group must have the same name attribute.

RadioButton value and single selection

I want to make a single selection in radiobutton in a gridview. I have added "GroupName" in radiobutton attributes but it only works in column which suppose to have a single selection in the entrire gridview. Another problem is getting the value of the radio button. Selected radio button value must appear in a textbox once it was clicked/checked.

RegularExpressionValidator always fires

Hi friends,I am trying to use a RegularExpressionValidator for email ID text box. Everything works fine till I add an AJAX TextBoxWatermarkExtender for the same text box. I have given the WatermarkText="Email" for the text box. When I push the submit button, the RegularExpressionValidator fires and says Invalid Email ID. When I clear the same text box, no issues and the records are saved.I strongly suspect that the RegularExpressionValidator is taking the text of the watermark, ie "Email" as an invalid email ID. To test this I gave the text as "someone@website.com" for the  TextBoxWatermarkExtender and it did not fire the RegularExpressionValidator.The Email ID field in my page is not mandatory but should have a valid email ID. Have any one faced same issue and does any one have a solution to this?I am pasting the code below:<asp:TextBox ID="txtEmail" runat="server" MaxLength="50" ToolTip="Enter Email" CssClass="input" ValidationGroup="register" > </asp:TextBox> <cc1:TextBoxWatermarkExtender ID="txtEmail_TextBoxWatermarkExtender" runat="server" Enabled="True" TargetCo

radiobutton list item make visible true or false in javascript

in my project i have used one radiobuttonlist according different user login , i want to make one of radiobuttonlist item visible true or false..   please help me to solve this issue.   thanks in advance.  

Saving radiobutton values

hi guysi am trying to save the values from 3 radiobuttons in my database and i cant get it to work . Please see my code belowProtected Sub Button3_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button3.Click        Dim smoker As String = "No"        Dim pastsmoker As String = "No"        Dim conn As New SqlConnection(ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString)        If smyes.Checked = True Then            smoker = "Yes"        ElseIf smpast.Checked = True Then            pastsmoker = "Yes"        End If        Try            Dim cmd As New SqlCommand("INSERT INTO Patient_History(Smoker,Pastsmoker) VALUES('" + smoker + "','" + pastsmoker + "')", conn)            conn.Open()            cmd.ExecuteNonQuery()  &nbs

very simple asp:RegularExpressionValidator for Email not working

My implementation is simple. I have a public static variable in a class called EmailHelper containing my regular expression as follows:namespace Base.Core.Utilities { public static class EmailHelper { public const string EMAIL_REGEX = @"^([a-zA-Z0-9]+([\.+_-][a-zA-Z0-9]+)*)@(([a-zA-Z0-9]+((\.|[-]{1,2})[a-zA-Z0-9]+)*)\.[a-zA-Z]{2,6})$"; } } I then have the following web controls on my page:<asp:Panel ID="pnlChangeEmail" runat="server" DefaultButton="btnChangeEmail"> <asp:Label ID="lblChangeEmail" AssociatedControlID="txtEmail" runat="server">New email:</asp:Label> <asp:TextBox ID="txtEmail" runat="server" CssClass="textfield"></asp:TextBox> <asp:LinkButton ID="btnChangeEmail" OnClick="Change_Email" runat="server" ValidationGroup="ChangeEmail" CssClass="btn"> <strong><asp:Literal runat="server" ID="litSubmit" Text='<%$ Resources: GlobalResource, SUBMIT %>' /></strong> </asp:LinkButton> <asp:RequiredFieldValidato

How do I make a RadioButton's Bullet align top

I have a RadioButton with two textblocks inside is. <RadioButton> <StackPanel> <TextBlock Text="{x:Staticprop:Resources.PrimaryInstallation}" TextWrapping="Wrap" /> <TextBlock Text="{x:Staticprop:Resources.PrimaryInstallationDescription}" TextWrapping="Wrap" Foreground="DimGray" /> </StackPanel> </RadioButton> Now the RadioButtons' buttet is aligned in the center of the text, but I want it to the top, VerticalAlignment top etc does not work, how do I do this note: I want the whole text to be aligned with the radiobuttons text and trigger the radiobutton to be checked so thats why I placed it inside it

Get the value of radiobutton from Gridview

I have Gridview with three server-side radio buttons in each row. How will I be able to get the value of the row of the selected radio button?

how to get and set radiobutton value without using text property?

I need 10 radiobuttons, but I do not want to use radiobutton list and I am not able to use Text property since I mark the Text for radiobutton in another row. All the radiobuttons' text are set as empty string. How can I get and set the value for the radiobuttons. Thanks.  <div>             <div> &nbsp;</div>            <div>                <span>1</span>&nbsp;&nbsp;                <span>2</span>&nbsp;&nbsp;                <span>3</span>&nbsp;&nbsp;            </div>            <div>                <span>4</span>&nbsp;&nbsp;                <span>5</span>&nbsp;&nbsp;            &n

RegularExpressionValidator - trailing blanks

This is crazy ... ALL I want to do is check for 10 or less AlphaNumeric characters, and ignore any trailing whitespace in the text box I am checking ... I am using this: ValidationExpression   ="^[a-zA-Z0-9]{1,10}$". The validator, however, is returning 10 characters, plus 4 white spaces as an error (ie, "abcfdsitnr    "  ... which should not be an error).  Can anyone help? please? Thanks.

RegularExpressionValidator and the new AsyncFileUpload

 Hi,I try to valide the new AJAX AsyncFileUpload control but it seems not to work : Control 'AsyncFileUpload1' referenced by the ControlToValidate property of 'REV1' cannot be validated.<cc1:AsyncFileUpload ID="AsyncFileUpload1" runat="server" Width="400px"                     ThrobberID="throbber" />                <asp:Label ID="throbber" Style="display: none" runat="server"><img alt="loading" src="images/upload.gif" /></asp:Label><asp:RegularExpressionValidator                    ID="REV1" runat="server" ErrorMessage=" File invalid"                    ControlToValidate="AsyncFileUpload1" ValidationExpression="(.*\.([gG][iI][fF]|[jJ][pP][gG]|[jJ][pP][eE][gG]|[bB][mM][pP]|[pP][nN][gG])$)"                    Display="Dynamic" Text="

radiobutton validation using javascript

hi' i have two radiobuttons and a button.On button click i have to validate whether the radiobutton is selected or not. I tried the following,but it is not working.pls help.<asp:RadioButton  runat="server" ID="rbyes" Text="Yes"  visible="true" GroupName="a"  /> <asp:RadioButton  runat="server" ID="rbno" Text="No" visible="true" GroupName="a" /> <asp:Button  ID="btnOk" runat="server" Text="OK" OnClick="btnOk_Click"  OnClientClick="return selectRadioButton();"/>function selectRadioButton(){var y=document.getElementById("ctl00_ContentPlaceHolder1_rbyes");var n=document.getElementById("ctl00_ContentPlaceHolder1_rbno");if(y.checked==false && n.checked==false){alert(Please select Yes/No");return false;}return true;}

How to bind two different list to dropdown base on radiobutton selection

  I have radio button and dropdown column types in sharepoint list, and apart from this i have two list. I want to bind the data to data from the two list base on the selection of radio button. If i select 'Yes' i want to bind from the one of two list, and when i select i want to bind it to another list. Is it possible in sharepoint ?. If yes can you help me out in this

more radiobutton-repeater problems


I'm using radio buttons in a repeater control.  I don't think I can use a radiobutton list.  I'm displaying one or two images in a table.  The table has three image cells, but only one or two of them can display an image, never all three.  I only want the radio buttons to be displayed if there are two images, and only in the two cells that contain the images.  if this can be duplicated with a radiobutton list, I'm all ears.

I have all this working by using an array list to populate the repeater.  The aray list includes a visible property that gets passed to the radio buttons.  I've managed to Google a solution to the radio group problem.  I though I had my issues resolved and was ready to move on to the rest of the coding but then I noticed another problem.

None of the radio buttons are initially checked.  If I run the page, check a radio button, click on the link button, the fact that I check one of the radio buttons doesn't register in the Repeater1_ItemCommand.  All the radio buttons show checked = false.  I don't want anything checked initially, but I did set one as checked = true to start to see what happens.  In the Repeater1_ItemCommand event, the radio buttons maintain their initial values, no matter what I do when the page runs.

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