Asp.Net controls not keeping state on postback

Upgraded an Asp.Net project from Visual Studio 2013 to Visual Studio 2015 and then updated Telerik Controls from Version 2015.1.401.45 to 2015.2.826.45 and noticed none of my dropdowns, treeview controls where keeping state on postbacks.  I was binding data to these controls as per normal, but on postbacks they where losing state, so the dropdowns where empty and the chosen items where obviously not being kept.

Checked my Web.Config and I still had sessionstate active:-

<sessionState mode="InProc" cookieless="false" timeout="30" />

Fix:-

After much scratching of head I had another look at web.config and compared against a version in source control that was working and noticed this little gem:-

<pages enableViewState="false">

      <controls><add tagPrefix="telerik" namespace="Telerik.Web.UI" assembly="Telerik.Web.UI" /></controls>

</pages>

So looks like the upgrade either with telerik or Visual Studio added:-

enableViewState="false"

After removing this my Asp.Net code worked again - phew!

Asp.Net Telerik RadAlert RadWindow change globalization language culture

Using Telerik excellent RadAlert within RadWindowManager in an Asp.Net Web Application and I need to translate my website into another language other than English.  So how do we change the RadAlert text on the buttons to be a different language depending on the users browser language settings?

For this I am using an Asp.Net Master Page and including both the RadWindowManager + RadScriptManager e.g.


Next create a Global Resources file for the default language (this case English) and also the language you are catering for (this case German):-


Change the MasterPage's code behind to associate the locatization file with the buttons:-


And that is it, so when a user runs your Web Application in a browser set to German it will now automatically change the buttons to the correct language for things like RadAlert.

Asp.Net Telerik RadGrid change globalization language culture

Using Telerik excellent RadGrid in an Asp.Net Web Application and need to translate my website into another language other than English.  In this case German so first download the resource file from Telerik currently located here:-

Global resources for RadGrid

Pop the file into App_GlobalResources folder or create one if you don't already have it:-


Here I am using the RadGrid.Main.resx (English) and RadGrid.Main.de.resx (German - all versions)

Now it does seem to pick up the language setting of the users browser settings so just do the switch in code (normally under Page_Load:-

if (!IsPostBack)

{

RadGrid.Culture = System.Globalization.CultureInfo.CurrentCulture

}

Using Telerik WPF RadWindow as MainWindow

Thought I would blog about how to use the Telerik abortion pill video WPF RadWindow as a MainWindow when using Visual Studio 2012 and .Net 4.5 (but I presume it will work with other versions).

So change the MainWindow.xaml from:-

<Window

to 

<telerik:RadWindow

Now this works fine but I notice that we have no taskbar icon, bit strange as this is default with the standard WPF form.  

To add this you will need a new reference:-

xmlns:navigation="clr-namespace:Telerik.Windows.Controls.Navigation;assembly=Telerik.Windows.Controls.Navigation"

navigation:RadWindowInteropHelper.ShowInTaskbar="True"


Now we get the Taskbar icon back but it is the default WPF one so to add a custom one I added my own icon to a new Resource file and then referenced it:-

navigation:RadWindowInteropHelper.Icon="Resources/MyIcon.ico"


I also want how to get the pill the icon to show in the WPF window itself.  So I add the following:-

<telerik:RadWindow.Icon>

     <Image Source="Resources/MyIcon.ico" Height="18"/>

</telerik:RadWindow.Icon>


I also want to add a Telerik style to the whole form so I just add in:-

telerik:StyleManager.Theme="Windows7"

 

The complete code looks like:-

<telerik:RadWindow

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

    xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"

    xmlns:navigation="clr-namespace:Telerik.Windows.Controls.Navigation;assembly=Telerik.Windows.Controls.Navigation"

    x:Class="MyProject.MainWindow"

    telerik:StyleManager.Theme="Windows7"

    navigation:RadWindowInteropHelper.ShowInTaskbar="True"

    navigation:RadWindowInteropHelper.Icon="Resources/ReportsIcon.ico"

    Header="My Telerik Form">    

    <telerik:RadWindow.Icon>

        <Image Source="Resources/ReportsIcon.ico" Height="18"/>

    </telerik:RadWindow.Icon>

</telerik:RadWindow>