How can you remove the table-tags in CreateUserWizard control

三世轮回 提交于 2019-12-13 15:17:39

问题


How can I use the CreateUserWizard control without having it render html tables?

I've customized the layout of the CreateUserWizard, and I'm using css to style it. My button is too far away from my form, due to the <table> tags asp.net is rendering by default.

<table cellspacing="0" cellpadding="0" id="cphContent_CreateUserWizard1" style="border-collapse: collapse; ">
    <tbody>
        <tr style="height: 100%; ">
            <td>
                <table cellspacing="0" cellpadding="0" style="height: 100%; width: 100%; border-collapse: collapse; ">
                    <tbody>
                        <tr>
                            <td style="height: 100%; width: 100%; ">
                                <fieldset>
                                    ...
                                </fieldset>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </td>
        </tr>
    </tbody>
</table>

回答1:


You can do this from design view and have visual studio generate the markup into template you can modify. In design view, click on the createUserWizard control, click on the angle bracket (>) at the top-right corner, then click Customize Create User Step. Switch to code and edit the markup to taste!!




回答2:


The CreateUserWizard doesn't have the RenderOuterTable property, but you can remove the table by using a LayoutTemplate and PlaceHolders (just like the ListView control).

This is an example:

<asp:CreateUserWizard runat="server" ActiveStepIndex="1"> 
  <LayoutTemplate> 
    <asp:PlaceHolder ID="WizardStepPlaceHolder" runat="server" />
    <asp:PlaceHolder ID="navigationPlaceHolder" runat="server" />
  </LayoutTemplate> 

  <HeaderTemplate>
    Header 
  </HeaderTemplate> 

  <StepNavigationTemplate>
    <asp:LinkButton runat="server" CausesValidation="False" CommandName="MovePrevious" Text="Previous" ID="StepPreviousButton">Previous</asp:LinkButton>
    <asp:LinkButton ID="NextLinkButton" runat="server" CommandName="MoveNext">Next</asp:LinkButton>
  </StepNavigationTemplate>

  <WizardSteps> 
    <asp:CreateUserWizardStep runat="server"> 
      <ContentTemplate> 
      </ContentTemplate> 
    </asp:CreateUserWizardStep> 

    <asp:CompleteWizardStep runat="server"> 
      <ContentTemplate> 
      </ContentTemplate> 
    </asp:CreateUserWizardStep> 
  </WizardSteps> 
</asp:CreateUserWizard> 



回答3:


You simply can not remove the table-tag from the control because the control is formatted this way.



来源:https://stackoverflow.com/questions/13205346/how-can-you-remove-the-table-tags-in-createuserwizard-control

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!