Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to reload the page in OnClick method?
Message
From
13/11/2006 13:54:08
Alexandre Palma
Harms Software, Inc.
Alverca, Portugal
 
General information
Forum:
ASP.NET
Category:
Other
Environment versions
Environment:
ASP.NET
Miscellaneous
Thread ID:
01169184
Message ID:
01169254
Views:
8
This message has been marked as the solution to the initial question of the thread.
That's easy just set the property of the button CauseValidation to False.
you can control what controls causes validation when they do a post back to the server.

>Your approach almost work. The problem is that calling method .ClearControlsValues() from the Sub of the button posts the page. Here is the problem. When the page is posted, .NET attempts to validate all controls. So if there is a control that requires entry, the validating control will stop the page from posting. Therefore, the control value I want to clear is not cleared. That is why I need to simply Reload the page and not posted. Or stop the page from validating when user clicks on this particular button.
>
>Thank you.
>
>>Again I don't understand what your trying to do I assume you have some code like the following, again this is vb.net code that you can convert to c#
>>
>>Private Sub mypage_load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
>>   If not Me.IsPostBack Then
>>      Me.CleanControlsValue()
>>   End If
>>... More code here.
>>End Sub
>>
>>Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click
>>   Me.CleanControlsValue()
>>End Sub
>>
>>
>>>Maybe your suggestion makes more sense, thank you. But I am clear about something. Let me describe better what I am trying to do:
>>>I want to have a button on the page that will clear all values in the textbox and dropdownlist controls of the page. Note that INPUT with type="reset" will not work here. So I need to reload the page and in the PAGE_LOAD method or in the method that you describe to clear the values.
>>>
>>>>Then what I think is that you don't want a page load, since you want to pass a parameter to it, it that case why do you create a method on your form and on the page load call that method and on the button click event call the same method passing the param you want.
>>>>looks like a more intuitive design and easy to read and maintain.
>>>>
>>>>>What is the command to put into the OnClick method of a button that will reload the page but not post it back. And at the same time I would like to "pass" a parameter to the server so that when the page is loaded I can use this parameter in the Page_Load method?
>>>>>
>>>>>Thank you in advance for your help.
Alexandre Palma
Senior Application Architect
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform