jeudi 29 janvier 2015

Why my grid doesn't have rows when I load my werbpart?



Scenario: - Webpart with MultiView control. I have some GridView controls inside some of the Views. All these views are NOT the view showed when we load the webpart for the first time. - The idea is to translate all the ASP.Net controls in the Page_Load event.


Problems: - When I call the translation function without testing the post back, the first translation is ok, but after that the texts became blank. I understand this occurs due to the fact I changed the control text, and as the control has EnableViewState = true, the next time the page is loaded it passes the already-translated text to be translated again, and as I don't have the translation for the already translated text, it becomes blank. - If I only call the translation when it' not a postback, then the controls that are not presented in the first time (remember, they are in other Views than the first one) do not translate properly.


The solution I see right now is to create a ViewState flag to control the translation for each grid, so I can guarantee it is translated just once, but it does sound strange.


Can anybody see a different way to do this?


Please do not answer with things like "use Resources", because I can't change this translation schema, it is mandatory in this case to NOT use resources. through a translation function, only when it's no








0 commentaires:

Enregistrer un commentaire