how to set(get) cookie value in ext.net

Posted by user591587 on Stack Overflow See other posts from Stack Overflow or by user591587
Published on 2011-03-02T07:21:23Z Indexed on 2011/03/02 7:24 UTC
Read the original article Hit count: 270

Filed under:
|

scene: when I click item in ext:ComboBox and want to set the item selected value to cookie variable. Finally, after I click ext:Button, the ext:Label get cookie value and display it.

But I get a error :Ext.Ajax Communication Failure , any help will be appreciated.

aspx:

 <ext:ComboBox ID="ComboBox1" runat="server" StoreID="Store1" Width="100" Editable="false"
                                DisplayField="name" ValueField="value" Mode="Local" TriggerAction="All`enter code here`" EmptyText="Select a locale...">

.....

aspx.cs

protected  void lngIndexChanged(object sender, DirectEventArgs e)
    {
        //Sets the cookie that is to be used by Global.asax
        HttpCookie cookie = new HttpCookie("CultureInfo");
        cookie.Value = ComboBox1.SelectedItem.Value ;
        Response.Cookies.Add(cookie);

        Label1.Text = cookie.Value;
        //Set the culture and reload for immediate effect. 
        //Future effects are handled by Global.asax
        Thread.CurrentThread.CurrentCulture = new CultureInfo(ComboBox1.SelectedItem.Value);
        Thread.CurrentThread.CurrentUICulture = new CultureInfo(ComboBox1.SelectedItem.Value);


    }

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about ext.net