473,763 Members | 8,423 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1152
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 AutoGenerateCol umns property to false.
<asp:datagrid id="myGrid" runat="server"
autogeneratecol umns=false
...
2.. Within the DataGrid declaration, declare a <Columns> element. 3.. Within the Columns element, define the <asp:TemplateCo lumn> 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:templateco lumn>

<itemtemplate >

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

...

</columns>HTH
Regards
Ashish M Bhonkiya

"mike parr" <mp********@yah oo.co.uk> wrote in message
news:Oo******** ******@TK2MSFTN GP12.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_ItemC ommand of the datagrid

Regards
Ashish M Bhonkiya
"mike parr" <mp********@yah oo.co.uk> wrote in message
news:ui******** ******@tk2msftn gp13.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********@yah oo.co.uk> wrote in message
news:ui******** ******@tk2msftn gp13.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
999
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 http://www.dnzone.com/ShowDetail.asp?NewsId=599 I want to create 3 template column in datagrid dynamically while the template columns contains image buttons for add, edit and delete. As you can see, I can figure out the commandname inside the...
0
2107
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" runat="server"> <asp:DataGrid id="DataGrid1" style="Z-INDEX: 101; LEFT: 8px; POSITION: absolute; TOP: 8px" runat="server" BorderColor="#E7E7FF" BorderStyle="None" BorderWidth="1px"
2
5357
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 coded a switch to handle the event. I have done this vb.net and it works fine..put in c# i can not catch the item command..i stepped into code via debug mode.. its just doest enter the dgrCaseType_ItemCommand... I AM TOTALLY CLULESS.....WHAT AM I...
9
4608
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 consistant. Thanks, Tom.
5
3529
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 selected items of that listbox and display it. can anyone help? Thanks
0
1248
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 specified in SelectedItemStyle. TIA
2
1959
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 template class. However, a class cannot create server controls (or at least this is beyond me). I am able to create HTML <INPUT> form elements, however, these are not wired to my datagrid and hence, when clicked do not fire the datagrid's...
0
1167
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; ........ public void ListDataGridDataBind()
1
2497
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 was clicked. So that I can then go and look into a hidden field as to what the value will be that I need to use. I am using a template column to create the imagebutton. <asp:TemplateColumn HeaderText="">
1
13307
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 ImageButton I needed to redirect the user to the Edit page where the data on the page would be prepopulated with data from the database. I tried several things without success then discovered that the CommandArgument property could be used for this...
0
9387
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10148
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9938
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9823
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7368
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6643
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5270
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3917
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2794
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.