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

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Make validation controls trigger only not clicking on submit button and not on other navigational bu

Posted By:      Posted Date: October 17, 2010    Points: 0   Category :ASP.Net

I have required validation controls on a page.  If the user got to this page by mistake and wants to go to a different section of the website using the navigational buttons; required validators are triggered and it will not let the user navigate away.  How do I get validators to trigger only when a submit button is clicked?


Thanks in advance!

View Complete Post

More Related Resource Links

ASP.NET: Selectively Enable Form Validation When Using ASP.NET Web Controls


Sometimes the extra controls that come with Visual Studio .NET can be a bit inflexible or they just don't provide enough functionality or flexibility for all situations. The ASP.NET form validation controls, while powerful and easy to use, require that the entire page be valid before it's submitted back to the server. Through the use of the new object-oriented features of Visual Basic .NET, it is possible to extend their functionality to overcome this limitation. This article tells you how and helps you decide when it's a good idea to keep validation on the client and when you'd be better off disabling it.

James M. Venglarik II

MSDN Magazine April 2002

Button in a form that does not submit


I've been trying to figure this out all afternoon but my google-fu seems to be failing me. I'm setting up a page with a fairly large form, which has one field that is going to require some kind of popup page that will allow the user to perform a lookup. At the moment I'm only prototyping the page so I'm actually only attempting to a the button up to fire an alert when the button is clicked instead of generating a lookup screen. However it seems that no matter what I do the button causes the form to submit.

I remember one of the very first ASP .NET beginner videos I ever watched went through configuring a button to perform actions without submitting, but I can't seem to figure out which one it was.

Clicking button and view in iframe


When i place the button in the website and i click the button,it runs as a full page.But i ant the website to run in the iframe.How do i do that?Because i want to place many button for different uses so i need it to view in iframe instead of a full page

Infopath form using Visual Studio - How to bind repeating table on submit button click ?


Hello friends,

   I have created infopath form using Visual Studio 2008

Form have 3 dropdowns and one repeating table which is bound by Datasource ( List from sharepoint ).

whenever i select appropritae values from drop down, Repeating table gets bound as datasource for dropdown and repeating table are same.

I have done conditional formating for repeating table using repeating table properties.


My Question:


Now i included one submit button and i want when i click submit button it will check DropDown Values and if appropriate record matching these values found it will fill repeating table

How i achive this ? as i dont find how to bind repeating table on submit button.

Please help if anyone have answer.


Thanks and Regards,


Kapil Bhosale.




Validation Controls Inside UpdatePanel

Hi All,If you use validation control, the base validator will render script WebForm_OnSubmit() to the page and add form onsubmit "onsubmit="javascript:return WebForm_OnSubmit();". This script is used to fire client side validation event.Now I have a listview inside updatepanel, when click edit button to fire the listview edit mode, the above validation script is just not rendered. How shall I work around with that? I need to customize the client validation event here.Thanks.

i want to set textbox(txtTitle) and button by clicking linkbutton but due to update panel it is not

Here this is my html code.....i want to set txtTitle and btnAdd by the GridView1's value....i tried Trigger.but unable to get desired output..can anyone draw me out of this problem??======================================================================================<cc1:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">    </cc1:ToolkitScriptManager>    <cc1:TabContainer ID="TabContainer1" runat="server" ActiveTabIndex="0"         Width="500px">               <cc1:TabPanel runat="server" HeaderText="Add Category" ID="TabPanel1">            <HeaderTemplate>Add Category            </HeaderTemplate>        <ContentTemplate>                <asp:UpdatePanel ID="UpdatePanel1" runat="server"><ContentTemplate>        <asp:Panel ID="Panel2" runat="server" Width="485px"    GroupingText=&q

Getting the data's next record, by clicking a button

Hi sorry if asked this twice, please help me understand how to get the next or before record from the database as from the below code i am only getting one record up, and please provide with code as i understand it better that way not that i am in a rush or anything.... thankyou.. please take a look at the code below private void button1_Click(object sender, RoutedEventArgs e) { NorthwindLINQDataContext mycontext = new NorthwindLINQDataContext(); var myquery = from myrow in mycontext.Orders select new { CID = myrow.CustomerID, EmpId = myrow.EmployeeID, OID = myrow.OrderID }; //This will retrieve all records from the db foreach (var valuesFromQuery in myquery) { textBox1.Text = valuesFromQuery.CID; textBox2.Text = valuesFromQuery.EmpId.ToString(); textBox3.Text = valuesFromQuery.OID.ToString(); } } private void NEXT_Click(object sender, RoutedEventArgs e) { NorthwindLINQDataContext mycontext = new NorthwindLINQDataContext(); } private void BEFORE_Click(object sender, RoutedEventArgs e) { NorthwindLINQDataContext mycontext = new NorthwindLINQDataContext(); } } D.Boy

how to apply validation controls on Gridview which is created dynamically

 hi, i created a gridview with two columns and 8 rows dynamically. All the rows are empty and editable at runtime. I am giving column names for this grid from some other .aspx page by passing column names using querystring.Because i am using this grid for three different pairs of column names.  i would like to know how to apply Required Field Validator, Regular Expression Validator  and Range Validator on Gridview textboxes. So that by using those validators i want to validate user inputs. And i would also like to know how to add rows at runtime for this grid. I am using ASP.net 2.0 and C#.net for this.(Visual Studio 2005) The code i am using to create gridview is below. <%@ Page Language="C#" AutoEventWireup="true" CodeFile="LoadData.aspx.cs" Inherits="LoadData" %>  <form id="form1" runat="server">  <div> <asp:GridView ID="GrdDynamic" runat="server" AutoGenerateColumns="False" ForeColor="#333333" BorderColor="GradientInactiveCaption" BorderStyle="Solid" style="z-index: 108; left: 24px; position: absolute; top: 13px">  <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />  <RowStyle BackColor="#EFF3FB"

add any number of dynamic controls on press of button

how can i add new control like image on every click of a button. the number of controls added should be number of times i pressed that button

make anonymous users submit data to a form library

isn't there a way for anonymous users to submit form data to a form library without custom code?

need help to implement validation with save button

hi, i was defeated a problem relating to the save button. i am running vb.net 2005 and the database is access. i have a project with application so there's a form which i wanted to restrict the user to fill all the textfields. say there are 5 textfiled(Fname, email and so on). what i am interested is that when even some one open the form and tries to fill some of them, there should be prompting message asking them to fill all, else the save button has to do its task. here's the code i was playing around but got a problem that when i fill all the text fields, there's no save only the restricting msg appears(" plz, fill the form probably then click save") NB: i put this code inside the save button. --------------------------------------------------------------- Dim success As Boolean Private Sub Save_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Save.Click If Product_DetailsBindingSource.Current Is Nothing Then MessageBox.Show("plz, fill the  feilds then click save button", Me.Text) success = False Else Me.Validate() success = DirectCast(Product_DetailsBindingSource.Current, products).Save() MessageBox.Show("save has completed successfully") Panel1.Show() End If   ------------------------ thanks so mch best regards hossenel

Is it Possible to Reuse a Trigger on Multiple Controls Easily?

I have a simple trigger that is generic such that I would like to reuse it on 15 different labels. Can I define it in one place somehow and just assing it to each of the labels rather than just pasting the same code into the style for each label?

How to update selected item state in the list box by clicking a button?

I created a listbox menu to browse through content by clicking items in the listbox. I also created ‘back’ and ‘forward’ type of navigation to browse through the same content based on the browsing history. I load content into frame and accessing the browsing history with NavigationCommands.BrowseBack and BrowseForward Properties. It is working great. However, I need to indicate a selected state of the listbox item related to the content shown in the frame while browsing with Back/Forward buttons. I have a hard time binding that property. What is the correct way to bind selected state of the listitem in this case? Thank you in advance. XAML: Button <Button x:Name="NavBack" Content="" HorizontalAlignment="Left" Margin="20,0,0,0" Style="{DynamicResource BackButtonStyle}" VerticalAlignment="Top" CommandTarget="{Binding ElementName=ContentFrame}" Command="{x:Static NavigationCommands.BrowseBack}" SnapsToDevicePixels="True" IsEnabled="{Binding CanGoBack, ElementName=ContentFrame, Mode=OneWay}" > XAML: Listsbox <ListBox x:Name="Nav_ListBox" Margin="0,18,0,0" ScrollViewer.HorizontalScrollBarVisibility="Hidden" Background="#FFF2F2F2" ItemsSource="

Redirecting to custom page while clicking on the user/group browse button

Hi, i have created a custom visual web part in visual studio 2010 and i deployed it into sharepoint site by creating a new page in my site. The custom page gets the data of users/groups from database and pass the users to the people picker in sharepoint.Here my question i have a document library where we upload document and get the users page popup that consists of people picker and a user/group browse button.when i click on the (book image button)browse button it will redirect to the user and group search page but here i need to replace my custom  user/group search page with the default one so please help me how to redirect to the custom page by clicking on the user/group browse button,and i need to pass the selected users to the people picker text box........please give me some solution whether this can be done or not if possibe please send me the link or some sample code how to do this   thank you.

Dynamically genrating textboxes by clicking add button

hi all, my problem is i want to generate gropu of texboxes by clicking add button(one row of textboxes).in my application i want to generate one complaint id.one customer may give two or more complaints at a time.suppose,he give two or more pnr numbers and their status andprioirty may differs.for this complaint i need to generate one common complaint id.how it is possible..?  

Dynamically genrating textboxes by clicking add button

hi all, my problem is i want to generate gropu of texboxes by clicking add button(one row of textboxes).in my application i want to generate one complaint id.one customer may give two or more complaints at a time.suppose,he give two or more pnr numbers and their status andprioirty may differs.for this complaint i need to generate one common complaint id.how it is possible..?

How to call to class by clicking button?

Hi. I add new class  to my project via "add --new item--class" now i wont to call added class by clicking button. how i do that? for example there is button click   private void button5_Click(object sender, RoutedEventArgs e) {   }
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