Last post Dec 29, 2016 01:35 PM by nizam.mcts
Dec 13, 2016 06:31 PM|bsarahim|LINK
Hi I have master page & child page, in master page(header) i have search box text control and button and each subpage/child page has some controls with required validators.
whenever the user entering the search, and pressing enter in master page, the child page validations will fire.. so the problem here is the enter key....any ideas how to control it
Dec 13, 2016 07:22 PM|Sumit.Pokhriyal|LINK
Apply ValidationGroup="Search" to master page search textbox required validator and button.
Hope this helps.
Dec 13, 2016 07:24 PM|A2H|LINK
have search box text control and button
Set the CauseValidation property of button to false
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:Button ID="BtnSearch" runat="server" CausesValidation="false" Text="Search" />
Dec 13, 2016 07:26 PM|Sumit.Pokhriyal|LINK
@A2H: Will it not ignore the master page textbox validation.
Dec 13, 2016 07:33 PM|A2H|LINK
Will it not ignore the master page textbox validation.
Dec 13, 2016 09:59 PM|some_yahoo|LINK
in HTML the FIRST button in your form will be executed on ENTER KEY. so
<input type="submit" ... /> --THIS ONE IS PRESSED ON THE ENTER KEY
<input type="submit" ... />
This is true even if you use the right align to make the first button in HTML appear visually after the other buttons on the page.
you might try making a hidden button with onclick=return"false" to disable the ENTER key. I have not tested this.
Dec 14, 2016 02:22 PM|bsarahim|LINK
sorry here is my code in master page, where search is happening
<asp:TextBox ID="TextBox1" runat="server" CssClass="form-control" aria-describedby="basic-addon3" placeholder="Search" autocomplete="off">
<asp:LinkButton ID="LinkButton1" runat="server" cssClass="glyphicon glyphicon-search"> </asp:LinkButton>
Private Sub LinkButton1_Click(sender As Object, e As System.EventArgs) Handles LinkButton1.Click
Response.Redirect("/search-g/search.aspx?q=" & TextBox1.Text.Trim)
search.aspx?q=" & TextBox1.Text.Trim, will show the google search page results.. of the website..
Dec 14, 2016 02:35 PM|Sumit.Pokhriyal|LINK
Did you try the two approaches mentioned above:
1. Applying ValidationGroup is content page
2. Specify CausesValidation="false" in LinkButton as mentioned by A2H
Both should work. Apply any one of them.
Dec 14, 2016 05:12 PM|bsarahim|LINK
I tired both, still not working..
I entered the some text in TextBox1(searchbox) and press enter, and all required validators of subpage is being displayed...
Dec 29, 2016 11:40 AM|Eric Du|LINK
According to your description and code, I make a test in my side, I found it run perfect, it can redirect to the another page with parameter value and without fire validation, so I hope you could post your sample for us to reproduce it and solve it.
Dec 29, 2016 01:35 PM|nizam.mcts|LINK
Create a property in master page for "CauseValidation" and from Child page set the property depending upon your requirment..