Ask a Question related to ASP.NET General, Design and Development.
-
sunil #1
Pager and Event Handling
OnItemCreated method of DataGrid I modified the Pager cell to have a button
TableCell pager = (TableCell)e.Item.Controls[0];
ImageButton hImg = new ImageButton();
hImg.ImageAlign=ImageAlign.Left;
hImg.ImageUrl="some.gif";
hImg.CommandName="SomeCommand";
pager.Controls.AddAt(0,hImg);
When i click on the ImageButton I get:
Object reference not set to an instance of an object
How can i handle the event from this Button.
Appreciate any help. Thanks
sunil Guest
-
Event Handling of pages
I want to display pages that are not connected to the application. The application is to activate a page then allow for a return. If I put the pages... -
Event Handling
I am having a difficult time with hadling events within my composite control. Sometimes what I do works perfectly, other times capturing an event is... -
EditCommandColumn event handling
I am creating a datagrid programmatically and am trying to add an EditCommandColumn to the datagrid but I'm having a hard time getting events for... -
ASP.NET Event handling.
Hi Friends I am having problem in Event handling in ASP.NET. Let me tell you what I am doing, I have having DataGrid for which I am using... -
ASP Event Handling
Hi I want to handle events of the AO Connection object in my ASP page. How can I do it? Please help me out. Thanks - Anuj -
Chris Jackson #2
Re: Pager and Event Handling
What are you doing in your onclick method? It appears as if the issue is in
the handler, not in the creation.
--
Chris Jackson
Software Engineer
Microsoft MVP - Windows XP
Windows XP Associate Expert
--
"sunil" <sunil_godiyal@yahoo.com> wrote in message
news:uT9TOmWTDHA.2280@TK2MSFTNGP12.phx.gbl...button> OnItemCreated method of DataGrid I modified the Pager cell to have a>
> TableCell pager = (TableCell)e.Item.Controls[0];
> ImageButton hImg = new ImageButton();
> hImg.ImageAlign=ImageAlign.Left;
> hImg.ImageUrl="some.gif";
> hImg.CommandName="SomeCommand";
> pager.Controls.AddAt(0,hImg);
>
> When i click on the ImageButton I get:
> Object reference not set to an instance of an object
> How can i handle the event from this Button.
> Appreciate any help. Thanks
>
>
>
>
>
>
>
>
Chris Jackson Guest
-
sunil #3
Re: Pager and Event Handling
Thanks Chris!!.Appreciate your reply
The ImageButton is not part of the aspx page. It is created dynamically and
added to the pager row.
How do i write onclick handler for it.?
i tried something like this.
hImg.Attributes["onclick"]="javascript:__doPostBack('"+DataGrid1.ClientID +"'
,'');";
but my OnItemCommand handler of datagrid is not called.
"Chris Jackson" <chrisj@mvps.org> wrote in message
news:OxviFwWTDHA.2180@TK2MSFTNGP10.phx.gbl...in> What are you doing in your onclick method? It appears as if the issue is> the handler, not in the creation.
>
> --
> Chris Jackson
> Software Engineer
> Microsoft MVP - Windows XP
> Windows XP Associate Expert
> --
> "sunil" <sunil_godiyal@yahoo.com> wrote in message
> news:uT9TOmWTDHA.2280@TK2MSFTNGP12.phx.gbl...> button> > OnItemCreated method of DataGrid I modified the Pager cell to have a>> >
> > TableCell pager = (TableCell)e.Item.Controls[0];
> > ImageButton hImg = new ImageButton();
> > hImg.ImageAlign=ImageAlign.Left;
> > hImg.ImageUrl="some.gif";
> > hImg.CommandName="SomeCommand";
> > pager.Controls.AddAt(0,hImg);
> >
> > When i click on the ImageButton I get:
> > Object reference not set to an instance of an object
> > How can i handle the event from this Button.
> > Appreciate any help. Thanks
> >
> >
> >
> >
> >
> >
> >
> >
>
sunil Guest



Reply With Quote

