Click here to Skip to main content
15,885,141 members
Home / Discussions / ASP.NET
   

ASP.NET

 
Questionplace a link in datalist to an image Pin
Meax2-Oct-08 12:07
Meax2-Oct-08 12:07 
AnswerRe: place a link in datalist to an image Pin
AlexeiXX32-Oct-08 16:32
AlexeiXX32-Oct-08 16:32 
QuestionWhy some business objects under App_code directory do not showing up when I place an ObjectDataSource control onto form? Pin
JUNEYT2-Oct-08 11:07
JUNEYT2-Oct-08 11:07 
QuestionBoth DataSource and DataSourceID are defined on 'Gridview' !! Pin
kindman_nb2-Oct-08 8:43
kindman_nb2-Oct-08 8:43 
AnswerRe: Both DataSource and DataSourceID are defined on 'Gridview' !! Pin
Adam °Wimsatt2-Oct-08 9:38
Adam °Wimsatt2-Oct-08 9:38 
GeneralRe: Both DataSource and DataSourceID are defined on 'Gridview' !! Pin
kindman_nb2-Oct-08 16:59
kindman_nb2-Oct-08 16:59 
QuestionCommunication between dynamically added custom user controls Pin
Adam °Wimsatt2-Oct-08 7:41
Adam °Wimsatt2-Oct-08 7:41 
AnswerRe: Communication between dynamically added custom user controls Pin
Andreas X2-Oct-08 20:06
professionalAndreas X2-Oct-08 20:06 
Hi!
I made a test on the issue. Check my code snippets:

EventInterface:

public delegate void ControlChangedDelegate(ControlChangedEventArgs e);

public class ControlChangedEventArgs : EventArgs
{
    private object controlInfo;
    public object ControlInfo
    {
        get { return controlInfo; }
        set { controlInfo = value; }
    }

    public ControlChangedEventArgs(object info)
    {
        controlInfo = info;
    }
    
}



/// <summary>
/// Summary description for EventInterface
/// </summary>
public interface EventInterface
{
    event ControlChangedDelegate ControlChanged;

    void Updatecontrol(object info);

}


The page:

public partial class _Default : System.Web.UI.Page, EventInterface
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    #region EventInterface Members

    public event ControlChangedDelegate ControlChanged;

    public void Updatecontrol(object info)
    {
        ControlChanged(new ControlChangedEventArgs(info));
    }

    #endregion
}


Control 1:

public partial class WebUserControl : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        ((EventInterface)this.Parent.Page).ControlChanged += new ControlChangedDelegate(WebUserControl_ControlChanged);
    }

    void WebUserControl_ControlChanged(ControlChangedEventArgs e)
    {
        string s = e.ControlInfo.ToString();
        // do th cool things
    }
}


Control 2:
public partial class WebUserControl2 : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        string controlInfo = this.ID;
        ((EventInterface)this.Parent.Page).ControlChanged += new ControlChangedDelegate(WebUserControl_ControlChanged);

        ((EventInterface)this.Parent.Page).Updatecontrol(controlInfo);
        
    }

    void WebUserControl_ControlChanged(ControlChangedEventArgs e)
    {
        string s = e.ControlInfo.ToString();
        // do the cool things

    }
}



i have not made any extensive test on this but i think it will work.
QuestionSaving a XmlDocument in Session Pin
drew252-Oct-08 4:35
drew252-Oct-08 4:35 
AnswerRe: Saving a XmlDocument in Session Pin
ToddHileHoffer2-Oct-08 4:55
ToddHileHoffer2-Oct-08 4:55 
Questionfile copying from 1 source to multiple destination???? Pin
Piyush Vardhan Singh2-Oct-08 0:11
Piyush Vardhan Singh2-Oct-08 0:11 
AnswerRe: file copying from 1 source to multiple destination???? Pin
Ashfield2-Oct-08 0:59
Ashfield2-Oct-08 0:59 
GeneralRe: file copying from 1 source to multiple destination???? Pin
Piyush Vardhan Singh2-Oct-08 1:41
Piyush Vardhan Singh2-Oct-08 1:41 
GeneralRe: file copying from 1 source to multiple destination???? Pin
Ashfield2-Oct-08 3:44
Ashfield2-Oct-08 3:44 
Question[Message Deleted] Pin
udhuman1-Oct-08 23:29
udhuman1-Oct-08 23:29 
AnswerRe: WDDX Format Pin
Ashfield2-Oct-08 1:01
Ashfield2-Oct-08 1:01 
GeneralRe: WDDX Format Pin
udhuman2-Oct-08 21:50
udhuman2-Oct-08 21:50 
AnswerRe: WDDX Format Pin
Vasudevan Deepak Kumar2-Oct-08 7:47
Vasudevan Deepak Kumar2-Oct-08 7:47 
QuestionScriptManager - AJAX Tool Error Pin
gautamamit81-Oct-08 22:16
gautamamit81-Oct-08 22:16 
AnswerRe: ScriptManager - AJAX Tool Error Pin
Paddy Boyd1-Oct-08 22:46
Paddy Boyd1-Oct-08 22:46 
AnswerRe: ScriptManager - AJAX Tool Error Pin
UD(IA)2-Oct-08 2:11
UD(IA)2-Oct-08 2:11 
AnswerRe: ScriptManager - AJAX Tool Error Pin
Brij2-Oct-08 2:46
mentorBrij2-Oct-08 2:46 
QuestionGetting a reference to a control on GridView RowEditing event Pin
johland1-Oct-08 20:23
johland1-Oct-08 20:23 
AnswerRe: Getting a reference to a control on GridView RowEditing event Pin
thomasa1-Oct-08 23:20
thomasa1-Oct-08 23:20 
GeneralRe: Getting a reference to a control on GridView RowEditing event Pin
johland1-Oct-08 23:33
johland1-Oct-08 23:33 

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.