I’m using Visual Studio 2010 / VB / dot net 4.0, and I have a drop-down menu in my left column that switches resource languages for the end user. It reads like this:
--------English ------- <<- Engish is always the default top language option
French |
Spanish |
German |
Japanese <<- drop-down options
Swedish |
Dutch |
Russian |
---------------------
| Set Language | <<- then they have to click the button
---------------------
How can I change this to just having “Select Language” showing as follows, and when the user drops down to their desired language, they don’t have to click a “set language” button, but it just automatically goes there? So it’d be like:
------Select Language----------------------
English |
French |
Spanish |
German |
Japanese <<- drop-down options; just go to when selected
Swedish |
Dutch |
Russian |
No button necessary, since once you select it, it just switches. I’ve tried different things but always keep getting errors. I’ve tried messing around with autopostback and changing things, but nothing is working. My current coding is like this:
<table class="tablestyle4">
<tr>
<td><br />
<asp:DropDownList ID="ddlCulture" DataTextField="DisplayName" DataValueField="Name"
runat="server" BackColor="#DDE4EC" ForeColor="#465C71" Width="130px" >
<asp:ListItem Value="en" meta:resourcekey="MenuItemResourcelangen1"></asp:ListItem>
<asp:ListItem Value="es-MX" meta:resourcekey="MenuItemResourcelangen2">
</asp:ListItem>
<asp:ListItem Value="fr" meta:resourcekey="MenuItemResourcelangen3"></asp:ListItem>
<asp:ListItem Value="de" meta:resourcekey="MenuItemResourcelangen4"></asp:ListItem>
<asp:ListItem Value="sv" meta:resourcekey="MenuItemResourcelangen5"></asp:ListItem>
<asp:ListItem Value="ja" meta:resourcekey="MenuItemResourcelangen6"></asp:ListItem>
<asp:ListItem Value="nl" meta:resourcekey="MenuItemResourcelangen7"></asp:ListItem>
<asp:ListItem Value="ru" meta:resourcekey="MenuItemResourcelangen8"></asp:ListItem>
</asp:DropDownList>
<asp:Button ID="btnSelect" Text="Change Language"
meta:resourcekey="MenuItemResourcelangen9" runat="server"
OnClick="btnSelect_Click" BackColor="#DDE4EC" ForeColor="#465C71"
BorderColor="Black" BorderStyle="Outset" Width="130px" BorderWidth="1px" />
</td>
</tr>
</table>
I just need a little help, and I should be able to take care of the rest — usually in VS source view, or winmerge. Thank you for anybody who can possibly offer some guidance!
Modify the dropdownlist this way
Making
AutoPostBack="true"will cause the PostBack and hence no need of a button.I also added a new item which will be the default text