vendredi 30 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.


[EDIT]: I tried using the RowCreated event to translate the header, and it worked at first. But when I go to another View of my MultiView and come back, the headers have the original untranslated value. Still working for a way to KEEP the translation.








0 commentaires:

Enregistrer un commentaire