Thanks, I figured that would be the case. I was just wondering if there was a better way than a whole bunch of "ifs" for each language we implement.
Tyrone Watt
Posts
-
Multi-lingual possessive case -
Multi-lingual possessive caseHi Not sure if this is the right forum for this as its more of a general question, but it didnt seem to fit any other category, and since I am looking for a c# solution.... I am looking for ideas to handle possessive case for a multi-lingual site. e.g John Smith's photo's (the 's after smith). Since the name is what the user entered, and in this case IN ENGLISH it requires an 's to make it possessive, but in some cases it will just require an apostrophe, without the (s). Doing this for a single language is easy enough when you know the rules, but how would you implement this on a site using Localization? Is there a better way than hard-coding the language rules per culture code? Thanks
-
Dynamic Control Postback Issue1. Thats what I thought, but its not... And as you mention in 2
Christian Graus wrote:
In the absence of viewstate, you don't get an event at all.
Which puzzles me because the event fires, but the viewstate property is still null. With 2, the "sender" in the onload is always the control itself, so unfortunately that doesnt help. Its in the onload that i need to know which control fired the postback, not in the onclick event(where the sender is the control that fired the event). Thanks for you input so far, do you have any other suggestions i can try. Been beating my head against a wall for a while on this now and its starting to hurt... :sigh:
-
Dynamic Control Postback IssueHi Thanks for that. I have no problem creating the controls in PageInit instead but either way that doesnt seem to be the case. The click event fires correctly after the page load, and the viewstate is set correctly in the "onclick" event, but it is not set in the page_load. So somewhere between the page_load and the onclick the viewstate is set back. Problem is I need to do things based on that viewstate before the click event or regardless of whether a click event occurred at all. With the second question, maybe i didnt phrase it correctly. What I need to know is which particular control fired the postback in the page_load. So if i have 6 user controls on a page and control 3 fired the postback. On the page_load for the page and all 6 controls is there a way to tell that it was control 3 that did the postback, or is a javascript hack with a hidden field the only way. As the event fires in the correct control, surely the must be some means of knowing which control fired the postback rather than just knowing that a postback occurred from one of the 6 controls. Thanks
-
Dynamic Control Postback IssueHi Im having a nightmare with a postback sequence so hopefully someone can give me ideas on how to solve this. Hopefully I will be able to explain my issue correctly. I have a Repeater on a page which contains a User Control in its Item Template The User Control has (among other things) a place holder control. Another user control is loaded dynamically with LoadControl (based on a database id) and added to the placeholder. So basically I end up with
Repeater
- UserControl (PageComponentController)
-- DynamicUserControl - UserControl (PageComponentController)
-- DynamicUserControl
etc
Repeater_ItemDataBound Snippet
CMS.Controls.PageComponentController pagecomponentcontroller = (CMS.Controls.PageComponentController)e.Item.FindControl("PageComponentController");
if (pagecomponentcontroller != null)
{
pagecomponentcontroller.PageComponent = pagecomponent;
pagecomponentcontroller.EditMode = _editmode;
pagecomponentcontroller.Zone = _zone;
pagecomponentcontroller.VirtualPage = _virtualpage;
}PageComponentController onLoad Snippet
_component = (CMS.Components.BaseComponent)LoadControl(_pagecomponent.Component.UserControlPath);
if (_component != null)
{
_component.PageComponent = _pagecomponent;
_component.EditMode = _editmode;
_component.VirtualPage = _virtualpage;
_component.Zone = _zone;
phComponent.Controls.Add((UserControl)_component);
}The UserControl (PageComponentController) contains two buttons "Edit" and "View" Which then sets a property inside DynamicUserControl This property is saved to the ViewState of the DynamicUserControl
public DAL.ComponentViews View
{
get
{
Object o = ViewState["COMPONENTVIEW"];
return (o == null) ? DAL.ComponentViews.View : (DAL.ComponentViews)o;
}
set
{
ViewState["COMPONENTVIEW"] = value;
}
}First problem is this viewstate is not remembered (always null) on postback so the control always displays its default state rather than the selected view. All the controls are populated again and show, but not the correct state. Is there anyway to save the state of dynamically loaded controls? Also, is it possible to tell which dynamic user control fired the postback? With a postback all the page_loads fire for all the controls on the page. The events wire
- UserControl (PageComponentController)