I have a masterpage, having same old header, footer and content sections. I have different aspx pages bases on this masterpage. But each aspx contains a web user control.
For ex. MasterPage -> SiteMaster.master,
ASPX -> CreateBid.aspx,
Web Control -> CreateBid.ascx.
I have used validation controls within web controls showing validation summary within the same control.
The problem here is that, the page postbacks even if validation fails. The validation summary is also shown, but page is postbacked.
Could someone help me why this is happening?
Although the page is postbacked, no code is executed. For ex. If i am clicking on Submit button, nothing is submitted, i could see the validation summary or messagebox but the page is refreshed. If i am considering simple aspx without masterpage the validation works perfectly without page refresh.
Thanks for sharing your valuable time.
Hai Raza,
Have a look at this it may be your answer Validators on postback
Related
I have read some articles on viewstate, but didn't find exactly what I wanted.
I have a simple aspx page on which I have a textbox and a button control.
If I disable the viewstate for the whole page at design time -> run the application -> then across postbacks after clicking the button,
what difference would I see on my page ?
I just want to see the difference between two cases i.e. viewstate enabled and viewstate disabled.
Can you please explain me with example ?
I have a MasterPage sectioned into a <div> tag for a Logo, Banner and a ASCX LogIn control, with the rest of the page in a <div> having the <asp:ContentPlaceHolder> to host all my ASPX pages. The Login control is in an Update panel.
Problem :
Some of the ASPX pages have an ASCX page with a input form with text boxes with Custom Validators. When I click on the LogIn button, the resulting postback also tries to post this input data and fails since the forms are blank with no data....and thus the postback for the LogIn too does not go through. On other ASPX pages with no validations, the LogIn goes through.
I could solve this by having a separate page for Login...maybe with a ModalPopup etc ? But isn't there any other way to tackle 2 buttons on the same page....one of which comes from the Master ?
If you aren't validating the controls in the login form, just use CausesValidation="false" on the login button. If you are validating the login form, use Validation Groups as recommended by MikeSmithDev to control which controls are validated on submit. Creating a Validation Group for just the login controls should segregate them from the other controls on the page.
How do you call a modalpopupextender(dialog panel) from any web page in the application with asp.net. lets say i have an email button on several pages and want to call the emailpopupextender. how would i do that?
For those having a similar issue here is a good tutorial for the user_control method of ModelPopupExtender How To: ModalPopupExtender as UserControl
Note: From what I've experienced, trying to call MPE in MasterPage from a page in an IFrame doesn't work. If someone has an idea of how to do please post comment or answer.
If you put your popup extender and all supporting stuff within your MasterPage you could then call it from any page that was rendered as the items would already be there.
If you don't want to do a Master Page solution you could create a UserControl for the process and include that on all pages.
When the ASP.net Page is Postback the controls inside the table is disappear,
but when i click on button that has that code which cause transfer to the page:
Server.Transfer("~/Admins/EditUsers.aspx");
all controls appear easy with no problems.
Then,is there is need to make refresh to the page, or what can i do?
Thanks
A postback already performs a page refresh automatically.
If controls are disappearing, that suggests that you might not be creating them on the postback. Note that tables do not store their contents in ViewState. Is there any chance you are testing for IsPostBack in your page Load handler? If so, you must recreate the table on every load, whether a postback or not.
Beyond that, you'd probably need to provide a bit more specific information.
I have asp.net application and a TabContainer from AjaxControlToolkit on a form. There are 4 tabs, each containing UpdatePanel, hidden button and some custom .ascx (each with it's own javascript file). Buttons are triggers for panels to update the contents and they are triggered from the 'OnClientActiveTabChanged' event of the TabContainer.
This technique is described here and similiar here. It's pretty simple when looking at it.
The only problem I have is that the whole scenario works when used as a separate page but it doesn't seem to work when masterpage is around that page. Suddenly buttons act as full postback controls.
Do you have any idea what's the reason?
Assuming the buttons your referring to are on the master page, I think you'll want to register the master page buttons as update panel triggers.
http://www.asp.net/ajax/tutorials/understanding-asp-net-ajax-updatepanel-triggers