onClick Event Not Firing

onClick Event Not Firing

am 09.03.2007 16:57:15 von RitaG

Hello.

I posted this question in the C# discussion group but am posting it here
also since ASP is involved.

I'm new to C# and need some help regarding an onClick event not firing.

I have a data grid that I add a cell to programatically. The cell is a
hyperlink and the onClick is set to _doPostBack. In my code I handle the
event but when I click on that added hyperlink nothing happens.

Here's my code (I'll just show the relevant stuff).
The data grid is dgBillSummary.

In MyClass.ascx I have a hidden LinkButton:
Visible="False">PostBack

Here's MyClass.ascx.cs
public class MyClass
protected System.Web.UI.WebControls.LinkButton lnkPostBack;
|
private void InitializeComponent()
this.lnkPostBack.Click += new System.EventHandler(this.lnkPostBack_Click);
|
private void dgBillSummary_PageIndexChanged(object source,
System.Web.UI.WebControls.DataGridPageChangedEventArgs e)
|
Label lblShowAll = new Label();
lblShowAll.Text = " onContextMenu=\"NoContextmenu();\" href=\"#ShowAll\"
onClick=\"_doPostBack('lnkPostBack','ShowAll');\"> Show All
";

e.Item.Cells[0].Controls.Add(lblShowAll); // here I'm adding a cell to the
data grid

|

// Here's the onClick event code that I never get to
private void lnkPostBack_Click(object sender, System.EventArgs e)
{
|
}

Any suggestions will be greatly appreciated!

TIA,
Rita

Re: onClick Event Not Firing

am 09.03.2007 18:44:29 von Anthony Jones

"RitaG" wrote in message
news:E12E86BD-3907-4060-8AA9-DD2F909F3432@microsoft.com...
> Hello.
>
> I posted this question in the C# discussion group but am posting it here
> also since ASP is involved.
>

Actually it's ASP.NET that's involved so you'll need to post it again to:-

microsoft.public.dotnet.framework.aspnet

Re: onClick Event Not Firing

am 09.03.2007 19:29:18 von RitaG

Thanks!

"Anthony Jones" wrote:

>
> "RitaG" wrote in message
> news:E12E86BD-3907-4060-8AA9-DD2F909F3432@microsoft.com...
> > Hello.
> >
> > I posted this question in the C# discussion group but am posting it here
> > also since ASP is involved.
> >
>
> Actually it's ASP.NET that's involved so you'll need to post it again to:-
>
> microsoft.public.dotnet.framework.aspnet
>
>
>