0

C#を使用したASP.NETで、ポストバックなしでパネルを表示する方法は?
3 つのリンク ボタンをクリックすることで切り替えられる 3 つのパネルがページに表示されます。1 つのボタンをクリックすると、1 つのパネルが表示され、もう 1 つのパネルが非表示に設定されます。その時点で、選択したリンクのパネルのみを表示する必要があります。

ポストバックを行わずに、このパネルの可視性を Java スクリプトで設定することは可能ですか?

これは私のaspxコードです:

 <asp:Panel ID="panelTxtImage" runat="server" 

    style="z-index: 1; left: 438px; top: 116px; position: absolute; height: 218px; width: 521px">
    <asp:Panel ID="PanelDropQuest" runat="server" 

        <asp:Label ID="LabelQuestGroup" runat="server" 
            style="z-index: 1; left: 15px; top: 13px; position: absolute; height: 24px; width: 131px;" 
            Text="Question Group" Font-Bold="True"></asp:Label>
        <asp:CheckBox ID="CheckBoxImage" runat="server" 
            style="z-index: 1; left: 107px; top: 101px; position: absolute" />
    </asp:Panel>
    <asp:DropDownList ID="DropQuestions" runat="server" 
     style="z-index: 1; left: 173px; top: 33px; position: absolute; height: 19px; width: 274px">
        <asp:ListItem Value="-1">Select</asp:ListItem>
    </asp:DropDownList>
    <asp:Label ID="LabelQuestion" runat="server" Font-Bold="True" 
        style="z-index: 1; left: 52px; top: 89px; position: absolute; height: 28px; width: 52px" 
        Text="Question"></asp:Label>
    <asp:TextBox ID="TxtWriteQuestion" runat="server" 
        style="z-index: 1; left: 173px; top: 85px; position: absolute; height: 24px; width: 325px" 
        TextMode="MultiLine"></asp:TextBox>
    <asp:Label ID="LabelImage" runat="server" Font-Bold="True" 
        style="z-index: 1; left: 47px; top: 124px; position: absolute; height: 20px; width: 105px" 
        Text="Capture Image"></asp:Label>
    <asp:Panel ID="Panel2" runat="server" 
        style="z-index: 1; left: 45px; top: 255px; position: absolute; height: 51px; width: 445px">
    </asp:Panel>
    <asp:Label ID="Label1" runat="server" 
        style="z-index: 1; left: 62px; top: 268px; position: absolute; height: 28px; width: 92px" 
        Text="QuestionGroup" Font-Bold="True"></asp:Label>
    <asp:Button ID="ButtonMultichoice" runat="server" 
        style="z-index: 1; left: 396px; top: 502px; position: absolute; height: 33px; width: 91px" 
        Text="Create" onclick="ButtonMultichoice_Click" />
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 

        style="z-index: 1; left: 122px; top: 698px; position: absolute; height: 142px; width: 222px">
        <Columns>
            <asp:TemplateField HeaderText="Column Name"></asp:TemplateField>
            <asp:TemplateField HeaderText="Type "></asp:TemplateField>
            <asp:TemplateField HeaderText="Values"></asp:TemplateField>
        </Columns>
    </asp:GridView>
  </asp:Panel>
4

2 に答える 2

2

パネル設定を行っている場合Visible="false"、パネルは生成された HTML でレンダリングされません。したがって、それを表示することはできません。

ただし、JavaScript を使用して表示/非表示を切り替えたい場合。display必要に応じて、値が「block」または「none」の cssのプロパティを使用します。

于 2013-06-25T12:07:28.030 に答える
2

css の助けを借りてこれを行うことができます。display:none; を含む css クラスを作成するだけです。プロパティを開き、このように Javascript を使用してそのクラスをパネルに追加します

document.getElementbyID("PanelID").className = CssclassName
于 2013-06-25T12:03:53.030 に答える