473,320 Members | 1,977 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

button in headertemplate of gridview

NH
I have this peice of code in my gridview

<HeaderTemplate>
<asp:ImageButton ID="btnPrevious"
ImageUrl="~/Images/Calendar/ico_Previous.png" runat="server" />
<asp:ImageButton ID="btnNext"
ImageUrl="~/Images/Calendar/ico_Next.png" runat="server" />
</HeaderTemplate>

How can I hook into the event handlers of these buttons i.e. when the user
clicks the button I want some server side code to execute but I cant figure
out how to hook up the code to the onclick event of the buttons?
Apr 7 '06 #1
3 3249
Hi,

You must use gridview's itemcomand event's and a command name to the button
in the header's template column. The button in the gridview can't have it's
own events, so you must use gridview's itemcommand events.

Have a nice day,

Aytaç ÖZAY
Software Developer

"NH" <NH@discussions.microsoft.com> wrote in message
news:B6**********************************@microsof t.com...
I have this peice of code in my gridview

<HeaderTemplate>
<asp:ImageButton ID="btnPrevious"
ImageUrl="~/Images/Calendar/ico_Previous.png" runat="server" />
<asp:ImageButton ID="btnNext"
ImageUrl="~/Images/Calendar/ico_Next.png" runat="server" />
</HeaderTemplate>

How can I hook into the event handlers of these buttons i.e. when the user
clicks the button I want some server side code to execute but I cant
figure
out how to hook up the code to the onclick event of the buttons?

Apr 7 '06 #2
NH
Thanks for the quick reply, I have got it working.
Thank you
N

"Aytaç ÖZAY" wrote:
Hi,

You must use gridview's itemcomand event's and a command name to the button
in the header's template column. The button in the gridview can't have it's
own events, so you must use gridview's itemcommand events.

Have a nice day,

Aytaç ÖZAY
Software Developer

"NH" <NH@discussions.microsoft.com> wrote in message
news:B6**********************************@microsof t.com...
I have this peice of code in my gridview

<HeaderTemplate>
<asp:ImageButton ID="btnPrevious"
ImageUrl="~/Images/Calendar/ico_Previous.png" runat="server" />
<asp:ImageButton ID="btnNext"
ImageUrl="~/Images/Calendar/ico_Next.png" runat="server" />
</HeaderTemplate>

How can I hook into the event handlers of these buttons i.e. when the user
clicks the button I want some server side code to execute but I cant
figure
out how to hook up the code to the onclick event of the buttons?


Apr 7 '06 #3
You're wellcome.

If you have a problem for doing this, post the problem again.

Good luck,
Aytaç ÖZAY

"NH" <NH@discussions.microsoft.com> wrote in message
news:E1**********************************@microsof t.com...
Thanks for the quick reply, I have got it working.
Thank you
N

"Aytaç ÖZAY" wrote:
Hi,

You must use gridview's itemcomand event's and a command name to the
button
in the header's template column. The button in the gridview can't have
it's
own events, so you must use gridview's itemcommand events.

Have a nice day,

Aytaç ÖZAY
Software Developer

"NH" <NH@discussions.microsoft.com> wrote in message
news:B6**********************************@microsof t.com...
>I have this peice of code in my gridview
>
> <HeaderTemplate>
> <asp:ImageButton ID="btnPrevious"
> ImageUrl="~/Images/Calendar/ico_Previous.png" runat="server" />
> <asp:ImageButton ID="btnNext"
> ImageUrl="~/Images/Calendar/ico_Next.png" runat="server" />
> </HeaderTemplate>
>
> How can I hook into the event handlers of these buttons i.e. when the
> user
> clicks the button I want some server side code to execute but I cant
> figure
> out how to hook up the code to the onclick event of the buttons?


Apr 7 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: bryan | last post by:
Hi all, I am working on a .net 2.0 web app. On page load I display a gridview with a drop down list (Employees), when the user selects from the drop down list, the grid view is filled with...
1
by: =?Utf-8?B?SmliZXkgSmFjb2I=?= | last post by:
Hi: I placed an <asp:Tableinside the HeaderTemplate of a TemplateField of a GridView. The contents of the <asp:Table just doesn't show up. Can someone please tell me why? Thanks, Jibey
8
by: Jeff | last post by:
ASP.NET 2.0 I have a webpage which contains a GridView. I want this GridView's HeaderTemplate to display the text "Inbox" or "Outbox"... So I think I need to set the value in the code behind...
0
by: Eraser | last post by:
Hi to all .NET guru guys... I have a problem in my delete button inside gridview. How to avoid postback on when i select cancel on confirmation message? But postback is okay on Ok confirmation....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.