question

RaviVerma-4270 avatar image
0 Votes"
RaviVerma-4270 asked YijingSun-MSFT answered

Globalization and Localization

In this code Str getting null value on page load and also on clicking Dropdown. how to solve this problem?

protected override void InitializeCulture()
{
base.InitializeCulture();
string str = Request["DropDownList1"];
if (str != null)
{
UICulture = str;
Culture = str;
}
}

dotnet-aspnet-webforms
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.


Maybe this will work: string str = DropDownList1.SelectedValue.


0 Votes 0 ·

1 Answer

YijingSun-MSFT avatar image
0 Votes"
YijingSun-MSFT answered

Hi @RaviVerma-4270 ,
Where do you write these codes? First, I think you need this:

 Request.Form["DropDownList1"]

And then InitializeCulture() are fired before page load. So, if you want to get the value, you need bind the data before InitializeCulture().

Best regards,
Yijing Sun


If the answer is helpful, please click "Accept Answer" and upvote it.

Note: Please follow the steps in our  documentation  to enable e-mail notifications if you want to receive the related email notification for this thread.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.