Click here to Skip to main content
15,914,222 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: How do I print out a DataGrid and its contents? Pin
g00fyman9-Jul-06 21:29
g00fyman9-Jul-06 21:29 
AnswerRe: How do I print out a DataGrid and its contents? Pin
Sushant Duggal9-Jul-06 19:27
Sushant Duggal9-Jul-06 19:27 
GeneralRe: How do I print out a DataGrid and its contents? Pin
blurMember9-Jul-06 21:27
blurMember9-Jul-06 21:27 
AnswerRe: How do I print out a DataGrid and its contents? Pin
blurMember9-Jul-06 22:24
blurMember9-Jul-06 22:24 
GeneralRe: How do I print out a DataGrid and its contents? Pin
Sushant Duggal10-Jul-06 3:45
Sushant Duggal10-Jul-06 3:45 
QuestionData Blocks Pin
Tiger4569-Jul-06 15:07
Tiger4569-Jul-06 15:07 
AnswerRe: Data Blocks Pin
Not Active9-Jul-06 16:16
mentorNot Active9-Jul-06 16:16 
QuestionForcing refresh of an HTML frame Pin
WebMaster9-Jul-06 15:03
WebMaster9-Jul-06 15:03 
AnswerRe: Forcing refresh of an HTML frame Pin
mnaveed9-Jul-06 22:25
mnaveed9-Jul-06 22:25 
GeneralRe: Forcing refresh of an HTML frame Pin
cloudking1196610-Jul-06 2:21
cloudking1196610-Jul-06 2:21 
QuestionASP.net MasterPages [modified] Pin
WebMaster9-Jul-06 13:13
WebMaster9-Jul-06 13:13 
QuestionQuery Strings and Frames Pin
JBL_Andon9-Jul-06 7:59
JBL_Andon9-Jul-06 7:59 
AnswerRe: Query Strings and Frames Pin
Guffa9-Jul-06 10:39
Guffa9-Jul-06 10:39 
Questionproved extra info for the membership? Pin
Snowjim9-Jul-06 6:56
Snowjim9-Jul-06 6:56 
QuestionCompiling 1.1 and 2.0 version of same library? Pin
rmatejka9-Jul-06 5:03
rmatejka9-Jul-06 5:03 
AnswerRe: Compiling 1.1 and 2.0 version of same library? Pin
RichardGrimmer11-Jul-06 5:26
RichardGrimmer11-Jul-06 5:26 
GeneralRe: Compiling 1.1 and 2.0 version of same library? Pin
rmatejka11-Jul-06 5:56
rmatejka11-Jul-06 5:56 
Questionevent in custom control [modified] Pin
g00fyman9-Jul-06 3:51
g00fyman9-Jul-06 3:51 
AnswerRe: event in custom control Pin
minhpc_bk9-Jul-06 16:45
minhpc_bk9-Jul-06 16:45 
GeneralRe: event in custom control Pin
g00fyman9-Jul-06 16:52
g00fyman9-Jul-06 16:52 
GeneralRe: event in custom control Pin
minhpc_bk9-Jul-06 17:13
minhpc_bk9-Jul-06 17:13 
GeneralRe: event in custom control Pin
g00fyman9-Jul-06 17:26
g00fyman9-Jul-06 17:26 
GeneralRe: event in custom control Pin
minhpc_bk9-Jul-06 18:24
minhpc_bk9-Jul-06 18:24 
GeneralRe: event in custom control Pin
g00fyman9-Jul-06 18:41
g00fyman9-Jul-06 18:41 
GeneralRe: event in custom control Pin
g00fyman9-Jul-06 19:05
g00fyman9-Jul-06 19:05 
ok went back to basics (and my asp books) and discovered this;

this does not work
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace WebMessageBox
{
  [DefaultProperty("Text")]
  [ToolboxData("<{0}:TestParent runat=server></{0}:TestParent>")]
  public class TestParent : Control, INamingContainer
  {
    private Button button = new Button();

    protected override void OnInit(EventArgs e)
    {      
      button.Text = "New Button";
      button.ID = base.UniqueID;
      button.Click += new EventHandler(button_Click);
    }


    protected override void Render(HtmlTextWriter writer)
    {
      base.Controls.Add(button);
      base.Render(writer);
    }

    void button_Click(object sender, EventArgs e)
    {
      Button button = (Button)sender;
      string s = button.Text;
    }

  }
}


this does work
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace WebMessageBox
{
  [DefaultProperty("Text")]
  [ToolboxData("<{0}:TestComposite runat=server></{0}:TestComposite>")]
  public class TestComposite : WebControl, INamingContainer
  {
    void button_Click(object sender, EventArgs e)
    {
      Button button = (Button)sender;
      string s = button.Text;
    }

    protected override void CreateChildControls()
    {
      Button button = new Button();
      button.Text = "New Button";
      button.ID = base.UniqueID;
      button.Click += new EventHandler(button_Click);

      base.Controls.Add(button);
    }
  }
}


any ideas on getting a rendered control to fire server events, otherwise i will have to rewrite my render code into CreateChildControls()?

kind regards,
g00fy

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.