开发者

DNN 5 viewstate

开发者 https://www.devze.com 2023-03-01 11:57 出处:网络
HI, I\'m working on DotNetNuke 5 module that basically consists of three pages; step 1, step2 and step3.

HI,

I'm working on DotNetNuke 5 module that basically consists of three pages; step 1, step2 and step3.

On Step 1 I'm showing a GridView with a CheckBox column and button that should navigate the user to Step 2.

In Step 2, I'm showing a GridView as well that shows the items that have been selected in Step 1.

My questions are:

  • What is the best way to pass my selection from Step 1 to Step 2? ViewState? Url-parameters?

    I tried in Step 1: ViewState["SelectedItems"] = string.Join(",", list.ToArray()); IN step 2: 开发者_如何学运维I did:

     var items = (string)ViewState["SelectedItems"];
    

And I found out items contains empty string. Is ViewState supported by DNN5?

  • The built-in ASP.Net wizard control doesn't offer enough flexibility for customizing it's look-and-feel and therefore it's not being used. Does DotNetNuke perhaps offers an alternative for ASP.NET WizardControl?

Thanks!


ViewState is definitely supported in DNN. However, if you've actually setup different pages for each step, ViewState isn't going to be available (it only persists across postbacks).

If you'd prefer to keep a three page scheme, using URL parameters if probably the easiest. If that's not palatable, then you'd have to store the info in either a cookie, in the database, or in the Session.

If you want to combine your steps into one control and use postbacks instead of redirection, then you can use ViewState. I don't think DNN exposes its wizard framework controls, but you can use a MultiView control or something similar to switch between the different steps more manually.


In my opinion, you will want 1 single .ASCX for your DNN Module, but you will want three panels inside, one for each step. I would call the panels Panel_Step1, Panel_Step2, and Panel_Step3. Steps 2 and 3 will be hidden initially.

Each panel will contain all of the controls and graphics for its respective step in the wizard.

So, when the user clicks the "Next Step" button to proceed from Step 1 to Step 2, your code will hide Panel_Step1 and show Panel_Step2. You will want an init function for Panel_Step2. Let's call it InitStep2().

Inside this InitStep2() function, you will be able to analyze the values and selections that the user made in Step 1 by analyzing the control values direction.

Example: Textbox_Step1_Name.text, DropDown_Step1_State.SelectedValue, etc.

These values are indeed stored in the viewstate.

Doing a wizard in this manner is really no different than doing it using an .ASCX outside of DNN. You have access to the viewstate, session, and more.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号