这就是发生的事情。我不明白为什么它不工作,因为如果我将代码复制到普通模板一切正常:S所以我不认为它的代码问题。我正在使用asp和c#![在此输入图像描述] [1]
http://s21.postimg.org/3jsi8351z/weird.png这是我用来解释问题的打印屏幕
天冬氨酸:
<asp:panel ID="pnltopico" runat="server" GroupingText="Topico" Height="100px"
Width="550px" Visible="False" Wrap="False">
<asp:DropDownList ID="droptopico" runat="server" AutoPostBack="True"
DataSourceID="SqlDataSource1" DataTextField="nome" DataValueField="Id_topico"
Height="22px"
onselectedindexchanged="DroptopicoSelectedIndexCha nged" Width="169px">
</asp:DropDownList>
<asp:panel ID="pnlpermissoestopico" runat="server" GroupingText="Permissões"
Height="59px" style="margin-top: 0px" Width="354px" Wrap="False"
ClientIDMode="inherit">
<asp:ListBox ID="lbpermitidotp" runat="server"
EnableViewState="true" Height="80px"
></asp:ListBox>
<asp:Button ID="btnproibirtp" runat="server" onclick="BtnpermitirClick"
Text=">>" />
<asp:Button ID="btnpermitirtp" runat="server" onclick="BtnnaopermitirClick"
Text="<<" Height="26px" />
<asp:ListBox ID="lbproibidotp" runat="server"
EnableTheming="False" EnableViewState="true" Height="80px" onselectedindexchanged="lbproibidotp_SelectedIndex Changed"
></asp:ListBox> </asp:panel>
因为代码工作正常我不认为我需要发布c#代码,但让我知道它是否有帮助。 谢谢你的帮助
答案 0 :(得分:0)
嘿我刚刚修改了你的代码并编译了它现在一切正常:
<asp:panel ID="pnltopico" runat="server" GroupingText="Topico" Height="100px"
Width="550px" Visible="False" Wrap="False">
<asp:DropDownList ID="droptopico" runat="server" AutoPostBack="True"
DataTextField="nome" DataValueField="Id_topico"
Height="22px"
onselectedindexchanged="droptopico_SelectedIndexChanged" Width="169px">
</asp:DropDownList>
</asp:panel>
<asp:panel ID="pnlpermissoestopico" runat="server" GroupingText="Permissões"
Height="59px" style="margin-top: 0px" Width="354px" Wrap="False"
ClientIDMode="inherit">
<asp:ListBox ID="lbpermitidotp" runat="server"
EnableViewState="true" Height="80px"
>
<asp:ListItem Text="Admin" Value="Admin" />
<asp:ListItem Text="Guest" Value="Guest" />
</asp:ListBox>
<asp:Button ID="btnproibirtp" runat="server" OnClick="btnproibirtp_Click"
Text=">>" />
<asp:Button ID="btnpermitirtp" runat="server"
Text="<<" Height="26px" />
<asp:ListBox ID="lbproibidotp" runat="server" EnableTheming="False" EnableViewState="true" Height="80px">
<asp:ListItem Text="Moderator" Value="Moderator" />
<asp:ListItem Text="Utilizer" Value="Utilizer" />
</asp:ListBox> </asp:panel>
我已将断点放在btnproibirtp的Button Click上,只是为了验证它是否正常工作, 我想你有一些标签形成错误左右:
protected void btnproibirtp_Click(object sender, EventArgs e)
{
string lbl1 = lbproibidotp.SelectedValue;
}
问候