Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
T

Tyrone Watt

@Tyrone Watt
About
Posts
5
Topics
2
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Multi-lingual possessive case
    T Tyrone Watt

    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.

    C# question csharp lounge

  • Multi-lingual possessive case
    T Tyrone Watt

    Hi 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

    C# question csharp lounge

  • Dynamic Control Postback Issue
    T Tyrone Watt

    1. 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:

    ASP.NET help database tutorial question

  • Dynamic Control Postback Issue
    T Tyrone Watt

    Hi 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

    ASP.NET help database tutorial question

  • Dynamic Control Postback Issue
    T Tyrone Watt

    Hi 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

    ASP.NET help database tutorial question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups