Click here to Skip to main content
15,912,897 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: usercontrol event Pin
Not Active17-May-10 9:52
mentorNot Active17-May-10 9:52 
GeneralRe: usercontrol event Pin
Dhyanga17-May-10 9:55
Dhyanga17-May-10 9:55 
GeneralRe: usercontrol event Pin
PunkIsNotDead17-May-10 13:55
PunkIsNotDead17-May-10 13:55 
GeneralRe: usercontrol event Pin
Not Active17-May-10 18:00
mentorNot Active17-May-10 18:00 
GeneralRe: usercontrol event Pin
PunkIsNotDead18-May-10 11:05
PunkIsNotDead18-May-10 11:05 
GeneralRe: usercontrol event Pin
Dhyanga18-May-10 2:31
Dhyanga18-May-10 2:31 
GeneralRe: usercontrol event Pin
Dhyanga18-May-10 2:43
Dhyanga18-May-10 2:43 
GeneralRe: usercontrol event Pin
PunkIsNotDead18-May-10 17:34
PunkIsNotDead18-May-10 17:34 
Ok! I know what you need! create a class (named ResponseEventArgs) that inherits the EventArgs and add a property named myValue. Like this
C#
public class ResponseEventArgs : EventArgs
{
    private String _myValue;
    public String MyValue
    {
        get { return _myValue; }
        set { _myValue = value; }
    }
}


Then in your ascx user control, add the event and the correct delegate
C#
public delegate void ResponseEventHandler(object sender, ResponseEventArgs d);

public event ResponseEventHandler ResultOfMyText;


here you've added the event ResultOfMyText and the handler ResponseEventHandler. Now in the ascx user control add the event as a virtual function
C#
[Description("Event that fires after button click of user control")]
protected virtual void OnResult_Show(ResponseEventArgs re)
{
    if (ResultOfMyText != null)
        ResultOfMyText(this, re);

}


Now in button Click event of the user control, add the correct value to MyValue Property
C#
//here is button_Click event of the user control
ResponseEventArgs re = new ResponseEventArgs();
re.MyValue = Txt_Value.Text;//You need a textbox named Txt_Value
OnResult_Show(re);


then when you've added this user control, you'll see that it has a event named ResultOfMyText. Trigger that event, and you'll see that you have a d.MyValue in ResultEventArgs and will execute that event every time that you click on the button inside the user control. I hope this won't be confused Wink | ;)
GeneralRe: usercontrol event Pin
Dhyanga19-May-10 3:23
Dhyanga19-May-10 3:23 
GeneralRe: usercontrol event [modified] Pin
PunkIsNotDead19-May-10 10:19
PunkIsNotDead19-May-10 10:19 
GeneralRe: usercontrol event Pin
Dhyanga20-May-10 5:09
Dhyanga20-May-10 5:09 
GeneralRe: usercontrol event Pin
PunkIsNotDead20-May-10 18:18
PunkIsNotDead20-May-10 18:18 
GeneralRe: usercontrol event Pin
Dhyanga24-May-10 3:13
Dhyanga24-May-10 3:13 
GeneralRe: usercontrol event Pin
PunkIsNotDead24-May-10 16:48
PunkIsNotDead24-May-10 16:48 
QuestionTabbed Excel Pin
Civic0617-May-10 5:58
Civic0617-May-10 5:58 
Questionstop Page scrolling upwards [modified] Pin
Enobong Adahada17-May-10 3:49
Enobong Adahada17-May-10 3:49 
AnswerRe: stop Page scrolling upwards Pin
dan!sh 17-May-10 5:22
professional dan!sh 17-May-10 5:22 
AnswerRe: stop Page scrolling upwards Pin
Rutvik Dave17-May-10 5:24
professionalRutvik Dave17-May-10 5:24 
GeneralRe: stop Page scrolling upwards Pin
DeepToot18-May-10 8:31
DeepToot18-May-10 8:31 
QuestionCannot find either column "dbo" or the user-defined function or aggregate "dbo.getname", or the name is ambiguous. Pin
sankararao17-May-10 3:24
sankararao17-May-10 3:24 
AnswerRe: Cannot find either column "dbo" or the user-defined function or aggregate "dbo.getname", or the name is ambiguous. Pin
Not Active17-May-10 3:39
mentorNot Active17-May-10 3:39 
AnswerRe: Cannot find either column "dbo" or the user-defined function or aggregate "dbo.getname", or the name is ambiguous. Pin
Peace ON17-May-10 3:47
Peace ON17-May-10 3:47 
GeneralRe: Cannot find either column "dbo" or the user-defined function or aggregate "dbo.getname", or the name is ambiguous. Pin
sankararao17-May-10 3:53
sankararao17-May-10 3:53 
GeneralRe: Cannot find either column "dbo" or the user-defined function or aggregate "dbo.getname", or the name is ambiguous. Pin
Peace ON17-May-10 3:59
Peace ON17-May-10 3:59 
QuestionHow to return Designer View for aspx page? Pin
Chesnokov Yuriy17-May-10 3:14
professionalChesnokov Yuriy17-May-10 3:14 

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.