Showing posts with label click. Show all posts
Showing posts with label click. Show all posts

Wednesday, March 28, 2012

The command MoveNext is not valid for the previous step, how to prevent this?

I am using WizardControl, on the first page, I have a validator, when user click next button or press enter, the validator will check the data and decide which step is the next step. But if I let it move to the last page, I will get error "The command 'MoveNext' is not valid for the previous step,...",I think it is because the last step doesn't have movenext button, and the validate event happens before nextbutton event, after it moves to the last step by code in the validator event, the nextbutton event need to be attached, but it could not find the object to attach. So I think I need a way to cancel the nextbutton event, any suggestion?

thanks!I am not sure what do you mean by "validator will check the data and decide which step is the next step." Can you post your code?
To cancel the nextbutton event you can do something like

protectedvoid Wizard1_NextButtonClick(object sender,WizardNavigationEventArgs e){
if(Wizard1.WizardSteps[e.CurrentStepIndex].StepType ==WizardStepType.Finish)
e.Cancel =true;
}


Thanks for reply.

On my first step page, there is a TextBox, user will type in their areacode, so I put a validator there to make sure user type in an areacode, and check if the areacode is valid, if it is valid, it will control which step is the next according the areacode. It looks like if I should put the code to decide which step to go into the NextButtonClick handler, but the validator event raises before the NextButtonClick event.
I saw that NextButtonClick event gets fired and saw the exception.
Canceling inside the event handler would not work in this scenario. So to avoid the firing of next button event completely wizardStep need to be templated. So you can get more control over the behavior of nextButton in the start step. Here is one example where next button click event doesnt get fired as the nextButton the the StartNavigationTemplate doesnt have the Command defined. I think that will server your purpose.

<asp:WizardID="Wizard1"runat="server">
<WizardSteps>
<asp:WizardSteprunat="server"Title="Step 1">
<asp:TextBoxID="TextBox1"runat="server"></asp:TextBox>
<asp:CustomValidatorID="CustomValidator1"runat="server"ErrorMessage="CustomValidator"OnServerValidate="CustomValidator1_ServerValidate"></asp:CustomValidator>
</asp:WizardStep>
<asp:WizardSteprunat="server"Title="Step 2">
</asp:WizardStep>
<asp:WizardStepID="Step3"runat="server">
</asp:WizardStep>
</WizardSteps>
<StartNavigationTemplate>
<asp:ButtonID="StartNextButton"runat="server"Text="Next"/>
</StartNavigationTemplate>
</asp:Wizard>

HTH,
Vishal

Saturday, March 24, 2012

The difference between Postback and CallBack ?

I know that Postback referring to the action users click a button to submit the form data.

In what situations do we say mention thecallbackaction?

(I found that there is a property Page.IsCallBack)

Regards,

Ricky

Hi there,

The difference between a callback and postback is that, as with a postback, a callback does not refresh the currently viewed page (i.e. does not redraw the page). You can think of it as a quick trip back to get some data etc. For example if there were two drop down boxes, the second dependant on the value of the first, when a user selects a value of a the first, rather then posting the whole page, doing some server side calculations and returning a new whole page to the client, a callback can enable you to only go fetch the required data. Obviously from this, View State is not updated with a callback (it's the same instance of the page just updated!!!).

Hope this helps.


Tom thats a good answer to the original posters question. So am I right in thinking callback are the core of the whole AJAX craze. I'm learning ajax at the moment, not ajax.net for just the regular ajax fundamentals and what you've sais about only fetching required date seems to ring a bell.

Also can callaback be implemented without the use of the .net ajax framework?


Hi,

Altough similar in end results to what can be achieved with AJAX (but limited compared to ajax) the callback functionality is not part of its framework and is a feature of just .NET 2.0 (other options avaialble with 1.1). Try the following article for more information it puts the difference between callback functionalty and AJAX into context.

http://www.geekpedia.com/tutorial155_ASP.NET-2.0-Script-CallBack-(Ajax-like).html

Thanks


i dont know it may help you or not... just check out this

This feature allows you to programmatically call server-side methods through client-side JavaScript code without the need for posting back the page.

http://dotnetjunkies.com/Article/E80EC96F-1C32-4855-85AE-9E30EECF13D7.dcik

with good sample


Thanks a lot, Tom.

Ricky.

Tuesday, March 13, 2012

The hidden part of the partial class of web page in vs 2005

Hi all,

I want to see the hidden part of the partial class of web page.

I tried to right click on the class name and click on Find All References,
although visual studio 2005 got the other references, I was prohibited from
going there by a message box saying: The definition of the object is hidden.

Is there any way to see that hidden part?

Thank you.
BishoyThese files are just in time (JIT) compiled - so they don't exist until you
run the app.

The way I do this is:

-Load the application (in 2.0 each page is it's own assembly by default, so
browse to the page you wan to see)
-Open: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temp orary ASP.NET Files
-Open the folder that's the same name as web project
-Open whatever folder you find twice (not the _shadow). mine looked like
5365350a\c79f3d9b
-Then you'll see a bunch of dll's name something like
App_Web.asldjkasldj.dll
-Use Reflector (http://www.aisto.com/roeder/dotnet/) FREE, and open each one
up until you see your file. You should see an ASP and _ASP namespace.

Karl

--
http://www.openmymind.net/
http://www.codebetter.com/
"Bishoy George" <bishoy@.bishoy.comwrote in message
news:uRiIZZ5vGHA.5084@.TK2MSFTNGP04.phx.gbl...

Quote:

Originally Posted by

Hi all,
>
I want to see the hidden part of the partial class of web page.
>
I tried to right click on the class name and click on Find All References,
although visual studio 2005 got the other references, I was prohibited
from going there by a message box saying: The definition of the object is
hidden.
>
Is there any way to see that hidden part?
>
Thank you.
Bishoy
>