473,738 Members | 3,658 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Datagrid / image button to edit

Is there any way to display an image button instead of the traditional
Edit/Update/Cancel push button in a datagrid (with bound data)?
Nov 19 '05 #1
4 6946
Sure. Just use a Template column. This sample has 2 buttons in it - Edit and
Delete.
Note the Delete is wrappen in a Span tag which pops up a Confirm dialog
prior to posting to the server.
If the user clicks No then the dialog closes and no postback occurs. If they
click Yes then the postback occurs.
<asp:TemplateCo lumn HeaderText="Edi t and Delete Buttons">
<ItemTemplate >
<asp:imagebutto n CommandName="bt nEdit" id="btnEdit" runat="server"
ImageUrl="~/img/edit.gif" ToolTip="Edit"> </asp:imagebutton >
<span onclick="return confirm('Do you really want to delete this
record from the system?')">
<asp:imagebutto n CommandName="bt nDelete" id="btnDelete"
runat="server" ImageUrl="~/img/delete.gif"
ToolTip="Delete "></asp:imagebutton >
</span>
</ItemTemplate>
</asp:TemplateCol umn>

--
Joe Fallon

"rkbnair" <rk*****@discus sions.microsoft .com> wrote in message
news:55******** *************** ***********@mic rosoft.com...
Is there any way to display an image button instead of the traditional
Edit/Update/Cancel push button in a datagrid (with bound data)?

Nov 19 '05 #2
The source code gives syntax errors.

Compiler does not recognize the imageurl etc.

"Joe Fallon" wrote:
Sure. Just use a Template column. This sample has 2 buttons in it - Edit and
Delete.
Note the Delete is wrappen in a Span tag which pops up a Confirm dialog
prior to posting to the server.
If the user clicks No then the dialog closes and no postback occurs. If they
click Yes then the postback occurs.
<asp:TemplateCo lumn HeaderText="Edi t and Delete Buttons">
<ItemTemplate >
<asp:imagebutto n CommandName="bt nEdit" id="btnEdit" runat="server"
ImageUrl="~/img/edit.gif" ToolTip="Edit"> </asp:imagebutton >
<span onclick="return confirm('Do you really want to delete this
record from the system?')">
<asp:imagebutto n CommandName="bt nDelete" id="btnDelete"
runat="server" ImageUrl="~/img/delete.gif"
ToolTip="Delete "></asp:imagebutton >
</span>
</ItemTemplate>
</asp:TemplateCol umn>

--
Joe Fallon

"rkbnair" <rk*****@discus sions.microsoft .com> wrote in message
news:55******** *************** ***********@mic rosoft.com...
Is there any way to display an image button instead of the traditional
Edit/Update/Cancel push button in a datagrid (with bound data)?


Nov 19 '05 #3
There is no source code error.
This is a copy of code from a fully functioning datagrid.

Ensure you copy all of the code including the <asp:TemplateCo lumn ...> tag
and place it in your datagrid. Change the name of the image and img folder
to your versions.
--
Joe Fallon

"rkbnair" <rk*****@discus sions.microsoft .com> wrote in message
news:D5******** *************** ***********@mic rosoft.com...
The source code gives syntax errors.

Compiler does not recognize the imageurl etc.

"Joe Fallon" wrote:
Sure. Just use a Template column. This sample has 2 buttons in it - Edit and Delete.
Note the Delete is wrappen in a Span tag which pops up a Confirm dialog
prior to posting to the server.
If the user clicks No then the dialog closes and no postback occurs. If they click Yes then the postback occurs.
<asp:TemplateCo lumn HeaderText="Edi t and Delete Buttons">
<ItemTemplate >
<asp:imagebutto n CommandName="bt nEdit" id="btnEdit" runat="server" ImageUrl="~/img/edit.gif" ToolTip="Edit"> </asp:imagebutton >
<span onclick="return confirm('Do you really want to delete this record from the system?')">
<asp:imagebutto n CommandName="bt nDelete" id="btnDelete"
runat="server" ImageUrl="~/img/delete.gif"
ToolTip="Delete "></asp:imagebutton >
</span>
</ItemTemplate>
</asp:TemplateCol umn>

--
Joe Fallon

"rkbnair" <rk*****@discus sions.microsoft .com> wrote in message
news:55******** *************** ***********@mic rosoft.com...
Is there any way to display an image button instead of the traditional
Edit/Update/Cancel push button in a datagrid (with bound data)?


Nov 19 '05 #4
I'm sorry. I did that and it works now.

However, how to make the edit button functional?
i.e. makes the grid editable, provide an update button, and update the
database?

"Joe Fallon" wrote:
There is no source code error.
This is a copy of code from a fully functioning datagrid.

Ensure you copy all of the code including the <asp:TemplateCo lumn ...> tag
and place it in your datagrid. Change the name of the image and img folder
to your versions.
--
Joe Fallon

"rkbnair" <rk*****@discus sions.microsoft .com> wrote in message
news:D5******** *************** ***********@mic rosoft.com...
The source code gives syntax errors.

Compiler does not recognize the imageurl etc.

"Joe Fallon" wrote:
Sure. Just use a Template column. This sample has 2 buttons in it - Edit and Delete.
Note the Delete is wrappen in a Span tag which pops up a Confirm dialog
prior to posting to the server.
If the user clicks No then the dialog closes and no postback occurs. If they click Yes then the postback occurs.
<asp:TemplateCo lumn HeaderText="Edi t and Delete Buttons">
<ItemTemplate >
<asp:imagebutto n CommandName="bt nEdit" id="btnEdit" runat="server" ImageUrl="~/img/edit.gif" ToolTip="Edit"> </asp:imagebutton >
<span onclick="return confirm('Do you really want to delete this record from the system?')">
<asp:imagebutto n CommandName="bt nDelete" id="btnDelete"
runat="server" ImageUrl="~/img/delete.gif"
ToolTip="Delete "></asp:imagebutton >
</span>
</ItemTemplate>
</asp:TemplateCol umn>

--
Joe Fallon

"rkbnair" <rk*****@discus sions.microsoft .com> wrote in message
news:55******** *************** ***********@mic rosoft.com...
> Is there any way to display an image button instead of the traditional
> Edit/Update/Cancel push button in a datagrid (with bound data)?


Nov 19 '05 #5

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

Similar topics

4
2445
by: Ester | last post by:
I have an interior design of a living room with lights and aircond image. My task is to load the living room image without any light and aircond images as background image of a WebForm after that I have to add image button which are lights and aircond images on top of this background image (living room). Instead of drag and drop an image button from the toolbox and browse the image link, I would like to load the image for the image button from...
2
2710
by: Ester | last post by:
Instead of drag and drop image button from Toolbox and name the image button id on the properties box, I would like to load image button ID from database. I created a database table that stores Image Button ID and Image (path name of the image for the image button). Example of the data will be: (ImgBtnLight, image\light.gif). The data type of the Image Button ID field in the database table is varchar whereas data type of image button in...
2
3957
by: Stan | last post by:
This is how I access Pieces field in my editable datargid during Update event: protected void grdMain_OnUpdate(Object sender, DataGridCommandEventArgs e) { string Pieces = ((TextBox) e.Item.FindControl ("txtPieces")).Text; .... }
1
4233
by: orangedesk | last post by:
Please let me know what all options can I try to make the itemcommand get called when a image button gets clicked? I tried some of the options like checking the autopost back before binding the datagrid. Then I tried putting a blank column in the datagrid too...but nothing seems working.... Let me know ASAP...... Thanks, Amaresh
1
2627
by: keithb | last post by:
I need help connecting an image button in a GridView control to an event handler. Using the OnCommand property results in the following error: Error 3 'UserControls_Rem.ImageButton_Command(object, System.Web.UI.WebControls.CommandEventArgs)' is inaccessible due to its protection level C:\local_websites\btm_root\UserControls\Rem.ascx 7 I must be doing something wrong here. Can someone offer a suggestion? Thanks,
1
6144
by: Phil_Cam | last post by:
Hello All On a webpage I have a standard paypal image button for purchases. I am trying to set it up so that it only shows up or is endabled when text is entered into a textbox and a button is pressed. To do this I set the type to hidden and changed the type of the button using javascipt to image. This works perfectly in Modilla's Firefox but in IE it says there is a scipt error. Here is the javascipt
2
8795
by: smokeyd | last post by:
i am trying to create a simple image button rollover.. i have searched this forum and found a number of solutions but none seem to work. i am just trying to get the onmouseover to swap the image then restore when rolled out on a web page in vb.net. please can someone help?
1
2179
by: ghjk | last post by:
I'm developing web application using jsp. There I want to disable image button(Edit and Remove)till user click on a record. I wrote disabled command but it didn't work. Can I user java script to this one?This is my code; Please help me.. <table width="360" border="0" class="txtnormalblack"> <tr> <td align="right" height="60"> <input name="submit" type="image" src="http://bytes.com/images/SubmitBtn.jpg"> <input name="edit" type="image"...
0
8968
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8787
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
9473
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...
0
9334
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
6750
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
6053
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
4824
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3279
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
2193
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.