1 Aralık 2011 Perşembe

Repeater disappears on postback

Lately I've been struggling with an ASP.NET Repeater control that holds some other controls in it which dynamically gets loadad with data.
I seemed to have one problem that whenever a postback occurs the repeater was disappearing.As much as I learned from my searches on the internet Repeater control is a dynamic control that needs to be databinded at every postback, I also learned that Page_Load is late for databinding to the repeater and it should be done in Repeater's Init method.
I really don't like these kind of controls but they are very handy in some cases, especially when you need to show dynamic or huge amount of records.In my scenario there were the categories and products at the top of the page you can add new category which is not in repeater but when add button is clicked repeater needs to be refreshed because it holds the categories list, and for deletion this is the same.

After all, I found out that my solution is about the ViewState, the repeater's EnableViewState property was set to false I turned it to true and nothing else was needed.

Here are some links I found benefitial:
Repeaters and Lost Data After Postback (Viewstate)
ViewState and Repeater Control
Repeater DataBinding on PostBack and base.DataBind()

28 Kasım 2011 Pazartesi

Changing the language of AJAX Control Toolkit Calender Extender Control

If you are using Ajax control tool kit then you have a Script manager on your aspx file, and it probably looks like this

asp:ScriptManager ID="ScriptManager1" runat="server"


Well, this will let you work with Ajax controls.However your calender extender's language will probably be English.If you need to change calender extender's culture what you need to do is below
Step 1: Check if you between your <@ Page /> tag you have set Culture as you wish it to be such as Culture="tr-TR"
Step 2: Add EnableScriptGlobalization to your script manager, and set it True then you will have
asp:ScriptManager ID="ScriptManager1" runat="server" EnableScriptGlobalization="true"


This will probably work, you can also check for another ways to do this on How to change the Culture of CalendarExtender programmatically.