Asp.net 自动回发属性不适用于选项卡容器
我在我的酒店管理系统门户网站上应用全球化,我遇到了一个问题。我的问题是,我有一个英文和西班牙文两种语言的下拉列表,我设置autopostback=true,因此从下拉列表中选择西班牙文,我的网页通过调用下面的方法成功地将英文转换为西班牙文Asp.net 自动回发属性不适用于选项卡容器,asp.net,c#-4.0,globalization,tabpanel,tabcontainer,Asp.net,C# 4.0,Globalization,Tabpanel,Tabcontainer,我在我的酒店管理系统门户网站上应用全球化,我遇到了一个问题。我的问题是,我有一个英文和西班牙文两种语言的下拉列表,我设置autopostback=true,因此从下拉列表中选择西班牙文,我的网页通过调用下面的方法成功地将英文转换为西班牙文 protected override void InitializeCulture() { if (Request.Form["ctl00$contentplaceholder1$language_drp"] !=
protected override void InitializeCulture()
{
if (Request.Form["ctl00$contentplaceholder1$language_drp"] != null)
{
UICulture = Request.Form["ctl00$contentplaceholder1$language_drp"];
}
base.InitializeCulture();
}
由于我已将autopostback属性设置为true,因此此函数被调用为successfull。
我也有编辑控件,我可以用西班牙语或英语编辑我的酒店详细信息,我还使用了标签容器来显示酒店的所有信息。
但是,当我单击“编辑”时,我的页面不会回发为true,这就是为什么我无法调用Inilize culture方法的原因,也是我无法转换页面语言的原因。
我在tabcontainer中应用了autopostback属性true,但失败。
在选项卡容器中,我有选项卡面板。
这是我的密码
<asp:TabContainer ID="TabContainerHotelDetails" runat="server" AutoPostBack="true"
Width="100%" OnLoad="TabContainerHotelDetails_Load">
<asp:TabPanel runat="server" HeaderText="General" ID="TabGeneral" >
<ContentTemplate>
<asp:Panel ID="PanelInfo" runat="server" Width="100%" GroupingText="<%$ Resources:Resource, LocalizedInformation %>">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="20%">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td style="padding-top: 10px; height: 30px;">
<asp:Label ID="metaHotelName" runat="server" Text="<%$ Resources:Resource, LocalizedHotelName %>"></asp:Label>
</td>
</tr>
<tr>
<td style="padding-top: 10px; height: 30px;">
<asp:Label ID="metaHotelStatus" runat="server" Text="<%$ Resources:Resource, LocalizedStatus %>"></asp:Label>
</td>
</tr>
<tr>
<td style="padding-top: 10px; height: 30px;">
<asp:Label ID="metaMemberShip" runat="server" Text="<%$ Resources:Resource, LocalizedMemberShipType %>"></asp:Label>
</td>
</tr>
<tr>
<td style="padding-top: 10px; height: 30px;">
<asp:Label ID="metaUserName" runat="server" Text="<%$ Resources:Resource, LocalizedUserName %>"></asp:Label>
</td>
</tr>
<tr>
<td style="padding-top: 10px; height: 30px;">
<asp:Label ID="metaEmail" runat="server" Text="<%$ Resources:Resource, LocalizedEmail %>"></asp:Label>
</td>
</tr>
<tr>
<td style="padding-top: 10px; height: 30px;">
<asp:Label ID="metaTotalPoint" runat="server" Text="<%$ Resources:Resource, LocalizedTotalPoint %>"></asp:Label>
</td>
</tr>
<tr>
<td style="padding-top: 10px; height: 30px;">
<asp:Label ID="metaRegistrationDate" runat="server" Text="<%$ Resources:Resource, LocalizedRegisteredDate %>"></asp:Label>
</td>
</tr>
<tr>
<td style="padding-top: 10px; height: 30px;">
<asp:Label ID="metaLastLogin" runat="server" Text="<%$ Resources:Resource, LocalizedLastLogin %>"></asp:Label>
</td>
</tr>
<tr>
<td style="padding-top: 10px; height: 30px;">
<asp:Label ID="metaEmailActivated" runat="server" Text="<%$ Resources:Resource, LocalizedEmailActivated %>"></asp:Label>
</td>
</tr>
<tr>
<td style="padding-top: 10px; height: 30px;">
<asp:Label ID="metaLockedOut" runat="server" Text="<%$ Resources:Resource, LocalizedLockedOut %>"></asp:Label>
</td>
</tr>
</table>
</td>
<td width="5%" style="border-right: 1px dotted black;">
</td>
<td>
<table border="0" cellpadding="0" cellspacing="0" style="padding-left: 10px;">
<tr>
<td style="padding-top: 10px; height: 30px;">
<asp:Label ID="lblHotelName" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td style="padding-top: 10px; height: 30px;">
<asp:Label ID="lblStatus" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td style="padding-top: 10px; height: 30px;">
<asp:Label ID="lblMembershipType" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td style="padding-top: 10px; height: 30px;">
<asp:Label ID="lblUserName" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td style="padding-top: 10px; height: 30px;">
<asp:Label ID="lblEmail" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td style="padding-top: 10px; height: 30px;">
<asp:Label ID="lblTotalPoints" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td style="padding-top: 10px; height: 30px;">
<asp:Label ID="lblRegisteredDate" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td style="padding-top: 10px; height: 30px;">
<asp:Label ID="lblLastLogin" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td style="padding-top: 10px; height: 30px;">
<asp:CheckBox ID="chkEmailActivated" runat="server" OnCheckedChanged="chkEmailActivated_CheckedChanged"
AutoPostBack="True" />
</td>
</tr>
<tr>
<td style="padding-top: 10px; height: 30px;">
<asp:CheckBox ID="chkLockedOut" runat="server" OnCheckedChanged="chkLockedOut_CheckedChanged"
AutoPostBack="True" />
</td>
</tr>
</table>
</td>
</tr>
</table>
</asp:Panel>
是否有任何方法可以轻松地执行此操作或替代此操作,以便在单击“编辑”后调用我的iniliazeculture方法。
请帮助我,因为我对堆栈溢出非常陌生。实际上,我不知道发布问题的好方法。您可以使用web方法初始化文化。为此,您必须首先创建javascript方法,当您单击edit选项卡时将调用该方法,并且可以从该脚本调用页面级web方法来初始化文化。希望这能对你们有所帮助。经过两天的搜索,我在这里找到了答案。 答案很简单: 我把我的语言的价值放在文化上
protected override void InitializeCulture()
{
if (Request.Form["ctl00$contentplaceholder1$language_drp"] != null)
{
UICulture = Request.Form["ctl00$contentplaceholder1$language_drp"];
}
if (Request.QueryString["HotelID"] != null)
{
this.UICulture = "es";
}
base.InitializeCulture();
}
其工作正常:当有回发时,更新面板将工作。在您的情况下,回发不会在单击“编辑”选项卡时发生。如果使用tabcontainer下的“更新”面板并将“自动回发”属性设置为true,会怎么样?但实际问题是tab container autopost back设置为true,但为什么tab container下的tab选项卡面板不回发页面?我正在考虑另一个解决方案,在从查询字符串获取页面id时,有没有办法回发另一个页面?查看是否请求。查询字符串[HotelID]!=null//这里我想发布回页{意思是说当我点击另一页上的编辑按钮时,我如何可以将我的第一页发布回我想初始化区域性的地方?我只想在查询字符串后发布回第一页来调用我的Inilize区域性?这有什么想法吗?