Click here to Skip to main content
16,017,193 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionEnable/Disable Button through javascript [modified] Pin
xfitr222-Sep-08 16:24
xfitr222-Sep-08 16:24 
AnswerRe: Enable/Disable Button through javascript Pin
Tamer Oz22-Sep-08 21:31
Tamer Oz22-Sep-08 21:31 
QuestionAjax and SQL Pin
Jacob Dixon22-Sep-08 13:51
Jacob Dixon22-Sep-08 13:51 
QuestionReportViewer Pin
kenexcelon22-Sep-08 11:53
kenexcelon22-Sep-08 11:53 
QuestionAdding data using a user control. Pin
udaykatakam22-Sep-08 8:28
udaykatakam22-Sep-08 8:28 
AnswerRe: Adding data using a user control. Pin
ToddHileHoffer22-Sep-08 10:38
ToddHileHoffer22-Sep-08 10:38 
GeneralRe: Adding data using a user control. Pin
udaykatakam22-Sep-08 13:28
udaykatakam22-Sep-08 13:28 
GeneralRe: Adding data using a user control. Pin
ToddHileHoffer23-Sep-08 2:21
ToddHileHoffer23-Sep-08 2:21 
Sorry I misunderstood. Here are some tips for you. Create a public property for any control in your user control that you want to use in the page. And vice versa. Most books will give you an example of using userControl.FindControl("id"). But I find it cleaner and easier if just create a public property.

As for events... In the page_init of the page containing the control is where you set the event. Here is a quick example...
Good luck.

<br />
//user control<br />
public partial class WebUserControl : System.Web.UI.UserControl<br />
{<br />
    public Button submitButton<br />
    {<br />
        get { return this.Button1; }<br />
        set { this.Button1 = value; }<br />
    }<br />
    protected void Page_Load(object sender, EventArgs e)<br />
    {<br />
<br />
    }<br />
<br />
    protected void Button1_Click(object sender, EventArgs e)<br />
    {<br />
<br />
    }<br />
}<br />
<br />
<br />
//page<br />
public partial class _Default : System.Web.UI.Page <br />
{<br />
    protected void Page_Init(object sender, EventArgs e)<br />
    {<br />
     this.WebUserControl1.submitButton.Click += new EventHandler(submitButton_Click);<br />
    }<br />
    protected void Page_Load(object sender, EventArgs e)<br />
    {<br />
      <br />
    }<br />
<br />
    protected void submitButton_Click(object sender, EventArgs e)<br />
    {<br />
        Response.Write("event handled");<br />
    }<br />
}<br />
<br />
<br />



I didn't get any requirements for the signature


GeneralRe: Adding data using a user control. Pin
udaykatakam23-Sep-08 19:28
udaykatakam23-Sep-08 19:28 
GeneralRe: Adding data using a user control. Pin
ToddHileHoffer24-Sep-08 2:05
ToddHileHoffer24-Sep-08 2:05 
Question[Message Deleted] Pin
strawberrysh22-Sep-08 8:26
strawberrysh22-Sep-08 8:26 
AnswerRe: adding a list to cache(for shoppingcart) Pin
ToddHileHoffer22-Sep-08 10:44
ToddHileHoffer22-Sep-08 10:44 
QuestionConnection Interrupted [modified] Pin
#realJSOP22-Sep-08 5:59
professional#realJSOP22-Sep-08 5:59 
AnswerRe: Connection Interrupted Pin
N a v a n e e t h22-Sep-08 19:49
N a v a n e e t h22-Sep-08 19:49 
Questionchange language Pin
brettokumar22-Sep-08 4:17
professionalbrettokumar22-Sep-08 4:17 
AnswerRe: change language Pin
Caio Kinzel Filho22-Sep-08 4:29
Caio Kinzel Filho22-Sep-08 4:29 
QuestionTextbox causing strange positioning bug in IE6 Pin
Mel Padden22-Sep-08 3:46
Mel Padden22-Sep-08 3:46 
QuestionThe connection name 'MyConnection' was not found in the applications configuration or the connection string is empty. Pin
enthusiastic47722-Sep-08 3:06
enthusiastic47722-Sep-08 3:06 
Questionasp.net application in mono project Pin
UD(IA)22-Sep-08 3:03
UD(IA)22-Sep-08 3:03 
AnswerRe: asp.net application in mono project Pin
Caio Kinzel Filho22-Sep-08 3:56
Caio Kinzel Filho22-Sep-08 3:56 
GeneralRe: asp.net application in mono project Pin
Krazy Programmer22-Sep-08 19:36
Krazy Programmer22-Sep-08 19:36 
Questionrefresh gridview on parent form after modal child form closed [modified] Pin
johland22-Sep-08 2:36
johland22-Sep-08 2:36 
AnswerRe: refresh gridview on parent form after modal child form closed Pin
ToddHileHoffer22-Sep-08 5:03
ToddHileHoffer22-Sep-08 5:03 
AnswerRe: refresh gridview on parent form after modal child form closed Pin
kenexcelon22-Sep-08 11:56
kenexcelon22-Sep-08 11:56 
Questionread image from the bitmap Pin
dews turner22-Sep-08 1:53
dews turner22-Sep-08 1:53 

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.