Click here to Skip to main content
15,910,210 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionA bit of Guidance is Required Pin
KhandelwalA19-Jun-09 23:42
KhandelwalA19-Jun-09 23:42 
AnswerRe: A bit of Guidance is Required Pin
Christian Graus19-Jun-09 23:50
protectorChristian Graus19-Jun-09 23:50 
Questionretrieving data through session id's? Pin
shankbond19-Jun-09 19:17
shankbond19-Jun-09 19:17 
AnswerRe: retrieving data through session id's? Pin
Christian Graus19-Jun-09 19:48
protectorChristian Graus19-Jun-09 19:48 
GeneralRe: retrieving data through session id's? Pin
shankbond20-Jun-09 1:55
shankbond20-Jun-09 1:55 
GeneralRe: retrieving data through session id's? Pin
Christian Graus20-Jun-09 12:44
protectorChristian Graus20-Jun-09 12:44 
GeneralRe: retrieving data through session id's? Pin
shankbond20-Jun-09 22:50
shankbond20-Jun-09 22:50 
QuestionDynamic Control Postback Issue Pin
Tyrone Watt19-Jun-09 9:04
Tyrone Watt19-Jun-09 9:04 
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 up correctly (for the most part Frown | :( ) but i need to know in the page_load of the dynamic control not just if a postback occurred by if the postback was fired by that particular control.
Is there a way to do this?

Thanks
AnswerRe: Dynamic Control Postback Issue Pin
Christian Graus19-Jun-09 11:14
protectorChristian Graus19-Jun-09 11:14 
GeneralRe: Dynamic Control Postback Issue Pin
Tyrone Watt20-Jun-09 2:10
Tyrone Watt20-Jun-09 2:10 
GeneralRe: Dynamic Control Postback Issue Pin
Christian Graus20-Jun-09 12:46
protectorChristian Graus20-Jun-09 12:46 
GeneralRe: Dynamic Control Postback Issue Pin
Tyrone Watt21-Jun-09 21:22
Tyrone Watt21-Jun-09 21:22 
QuestionConvert datetime to date Pin
mahichandu19-Jun-09 8:56
mahichandu19-Jun-09 8:56 
AnswerRe: Convert datetime to date [modified] Pin
Manas Bhardwaj19-Jun-09 9:44
professionalManas Bhardwaj19-Jun-09 9:44 
QuestionRe: Convert datetime to date Pin
mahichandu22-Jun-09 11:49
mahichandu22-Jun-09 11:49 
QuestionGridview AJAX hovermenu problem Pin
Ridge Howison19-Jun-09 7:00
Ridge Howison19-Jun-09 7:00 
QuestionIIS wont serve up web pages Pin
dwolver19-Jun-09 5:26
dwolver19-Jun-09 5:26 
AnswerRe: IIS wont serve up web pages Pin
Abhijit Jana19-Jun-09 8:52
professionalAbhijit Jana19-Jun-09 8:52 
GeneralRe: IIS wont serve up web pages Pin
dwolver19-Jun-09 11:43
dwolver19-Jun-09 11:43 
QuestionASP.NET session synch with Legacy ASP 3.0 problem Pin
dew219-Jun-09 4:56
dew219-Jun-09 4:56 
AnswerRe: ASP.NET session synch with Legacy ASP 3.0 problem Pin
DoctorMick19-Jun-09 5:34
DoctorMick19-Jun-09 5:34 
GeneralRe: ASP.NET session synch with Legacy ASP 3.0 problem Pin
dew222-Jun-09 8:53
dew222-Jun-09 8:53 
QuestionCreate a page instance with controls? Pin
Lukaspojk19-Jun-09 4:27
Lukaspojk19-Jun-09 4:27 
AnswerRe: Create a page instance with controls? Pin
Abhishek Sur19-Jun-09 6:12
professionalAbhishek Sur19-Jun-09 6:12 
GeneralRe: Create a page instance with controls? Pin
Lukaspojk19-Jun-09 21:32
Lukaspojk19-Jun-09 21:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.