473,396 Members | 1,945 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,396 software developers and data experts.

datagrid imagebutton

In a datagrid is it possible to use an imagebutton in for my
ButtonColumn rather than the standard button provided? And if so, does
anybody have a code example?
Cheers,

Mike

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #1
4 1143
A TemplateColumn is used in cases where authors need complete control over
the contents of a Datagrid column. The TemplateColumn is declared with an
<ItemTemplate> element, which in turn is used to define the content that
will be rendered for each item in the column. The ItemTemplate can include
any valid HTML, including s.

To add a template column

1.. Set the DataGrid control's AutoGenerateColumns property to false.
<asp:datagrid id="myGrid" runat="server"
autogeneratecolumns=false
...
2.. Within the DataGrid declaration, declare a <Columns> element. 3.. Within the Columns element, define the <asp:TemplateColumn> control,
along with the required <ItemTemplate> element.
4.. Within the ItemTemplate, define the HTML or server control you intend
to display.
5.. Optionally set the TemplateColumn control's other properties
<columns>

<asp:templatecolumn>

<itemtemplate>

<img width=60 align="top"
src="/aspxtreme/shared/images/title-{0}.gif">
</itemtemplate>
</asp:templatecolumn>

...

</columns>HTH
Regards
Ashish M Bhonkiya

"mike parr" <mp********@yahoo.co.uk> wrote in message
news:Oo**************@TK2MSFTNGP12.phx.gbl... In a datagrid is it possible to use an imagebutton in for my
ButtonColumn rather than the standard button provided? And if so, does
anybody have a code example?
Cheers,

Mike

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 18 '05 #2
Ashish,

When using a Button Column, I would normally use CommandName to set the
name of an event to react to the button being pressed.

How would I do this using a Template Column?
Thanks,

Mike

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #3
mike parr,

do it in the DataGrid1_ItemCommand of the datagrid

Regards
Ashish M Bhonkiya
"mike parr" <mp********@yahoo.co.uk> wrote in message
news:ui**************@tk2msftngp13.phx.gbl...
Ashish,

When using a Button Column, I would normally use CommandName to set the
name of an event to react to the button being pressed.

How would I do this using a Template Column?
Thanks,

Mike

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 18 '05 #4
Hi mike parr,

this will help you to get more details on how to use the buttoncolumns.
http://www.dotnetjohn.com/articles.aspx?articleid=45
Regards
Ashish M Bhonkiya

"mike parr" <mp********@yahoo.co.uk> wrote in message
news:ui**************@tk2msftngp13.phx.gbl...
Ashish,

When using a Button Column, I would normally use CommandName to set the
name of an event to react to the button being pressed.

How would I do this using a Template Column?
Thanks,

Mike

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 18 '05 #5

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

Similar topics

0
by: Andy Eshtry | last post by:
Hello Dear Professionals: Based on this document: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/vbtskcreatingwebservercontroltemplatesdynamically.asp or this...
0
by: Reb | last post by:
I am using a datagrid within another datagrid. My second datagrid is expand/collapse one. I am facing some error. This is my code. ExpandGrid.aspx <form id="Form1" method="post"...
2
by: Syed Sami R. Shah | last post by:
hi all, i am having problem with using itemcommand of datagrid by way of asp:image button. i have put an image button in a datagrid item template and have set CommandName="DeleteRecord" and have...
9
by: tshad | last post by:
Is there a way to use your own image in place of the automatic one that ASP uses when doing editing in your DataGrid pages? We already have a style of button we are using and would like to be...
5
by: Lie | last post by:
Hi all, I have problem in getting selectedindex of multiple listbox selection in a datagrid. I have a listbox with multiple selection mode inside datagrid. In Edit mode, I need to get back all...
0
by: MattC | last post by:
Hi, I have place the following code in my ItemDataBound event: The problem I have is that when I select a row for editing using the edit command it no longer changes the CSSClass to the one...
2
by: charliewest | last post by:
I am dynamically creating my datagrid, building each column in real-time via code-behind (using c#). The only way i have read to add ImageButtons to my grid dynamically is by creating a separate...
0
by: sda | last post by:
Hi everybody, I have a problem to fire an event in a DataGrid. 1/ I have got a datagrid in a generic user control protected System.Web.UI.WebControls.DataGrid dgListDataGrid; ........ ...
1
by: Brett Wesoloski | last post by:
I am having problems getting the index of an image click event in a datagrid. Every time I look at the index it is -1. What I am trying to do is get the index of the row in which the imagebutton...
1
nateraaaa
by: nateraaaa | last post by:
While working on a recent project I discovered how useful the CommandArgument property can be. I needed to determine the record_id of a row displayed in my datagrid. When the user clicked the Edit...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.