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

Button images in DataGrid editing

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.
Nov 18 '05 #1
9 4579
tshad wrote:
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.


Tom, are you using an EditCommandColumn for the Edit/Update/Cancel
buttons in the DataGrid, and are wanting to replace those with a custom
image file? If this is the case, all you have to do is set the
EditText, CancelText, UpdateText properties of the EditCommandColumn to
the appropriate HTML (i.e., <img src=edit.gif>, or what have you).

If you are wanting, instead, to apply a CSS style (which you last
sentence makes it sound like), see this FAQ:
http://datawebcontrols.com/faqs/Butt...rButtons.shtml

Happy Programming!

--

Scott Mitchell
mi******@4guysfromrolla.com
http://www.4GuysFromRolla.com

* When you think ASP.NET, think 4GuysFromRolla.com!
Nov 18 '05 #2
"Scott Mitchell [MVP]" <mi******@4guysfromrolla.com> wrote in message
news:41************@4guysfromrolla.com...
tshad wrote:
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.
Tom, are you using an EditCommandColumn for the Edit/Update/Cancel buttons
in the DataGrid, and are wanting to replace those with a custom image
file? If this is the case, all you have to do is set the EditText,
CancelText, UpdateText properties of the EditCommandColumn to the
appropriate HTML (i.e., <img src=edit.gif>, or what have you).


Yes.
<asp:EditCommandColumn EditText="Edit Info"
visible="true"
ButtonType="PushButton"
UpdateText="Update" CancelText="Cancel" />

Where would I put the imgs? I assume I would take out the EditText,
UpdateText and CancelText. Where would I put it if it were Edit.png,
Update.png and Cancel.png?

Where is a good place to find properties for each object (DataGrid,
EditCommandColumn etc)? I am always scrambling to find out how to set a
background or font property and the names are always different depending
whether you are using CSS or HTML or ASP.NET.

If you are wanting, instead, to apply a CSS style (which you last sentence
makes it sound like), see this FAQ:
http://datawebcontrols.com/faqs/Butt...rButtons.shtml
I am looking at this also. At the moment, I need a quick and dirty way to
do this.

Thanks,

Tom
Happy Programming!

--

Scott Mitchell
mi******@4guysfromrolla.com
http://www.4GuysFromRolla.com

* When you think ASP.NET, think 4GuysFromRolla.com!

Nov 18 '05 #3
tshad wrote:
"Scott Mitchell [MVP]" <mi******@4guysfromrolla.com> wrote in message
news:41************@4guysfromrolla.com...
tshad wrote:
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.
Tom, are you using an EditCommandColumn for the Edit/Update/Cancel buttons
in the DataGrid, and are wanting to replace those with a custom image
file? If this is the case, all you have to do is set the EditText,
CancelText, UpdateText properties of the EditCommandColumn to the
appropriate HTML (i.e., <img src=edit.gif>, or what have you).

Yes.
<asp:EditCommandColumn EditText="Edit Info"
visible="true"
ButtonType="PushButton"
UpdateText="Update" CancelText="Cancel" />

Where would I put the imgs? I assume I would take out the EditText,
UpdateText and CancelText. Where would I put it if it were Edit.png,
Update.png and Cancel.png?


<asp:EditCommandColumn EditText="<img src='Edit.png'>" ... />
Where is a good place to find properties for each object (DataGrid,
EditCommandColumn etc)? I am always scrambling to find out how to set > a background or font property and the names are always different depending whether you are using CSS or HTML or ASP.NET.


The technical documentation's a good start. If you download the .NET
SDK, or if you have Visual Studio .NET installed on your computer, you
have an offline documentation resource. There's also Google, MSDN, etc.
For example, to find the DataGrid properties just Google using:

site:http://msdn.microsoft.com DataGrid class

http://www.google.com/search?sourcei...DataGrid+class

Whose first link is:
http://msdn.microsoft.com/library/de...ClassTopic.asp

Also, if you're going to be doing a lot of work with the DataGrid, might
I suggest you pick up a copy of my book, ASP.NET Data Web Controls Kick
Start? It's 350+ pages on nothin' but the DataGrid, DataList, and Repeater:

Sample Chapter: http://www.4guysfromrolla.com/webtech/chapters/ASPDWC/
Buy it: http://www.4guysfromrolla.com/aspscr...oto.asp?ID=148

Happy Programming!

--

Scott Mitchell
mi******@4guysfromrolla.com
http://www.4GuysFromRolla.com

* When you think ASP.NET, think 4GuysFromRolla.com!
Nov 18 '05 #4
"Scott Mitchell [MVP]" <mi******@4guysfromrolla.com> wrote in message
news:41**************@4guysfromrolla.com...
tshad wrote:
"Scott Mitchell [MVP]" <mi******@4guysfromrolla.com> wrote in message
news:41************@4guysfromrolla.com...
tshad wrote:

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.

Tom, are you using an EditCommandColumn for the Edit/Update/Cancel
buttons in the DataGrid, and are wanting to replace those with a custom
image file? If this is the case, all you have to do is set the EditText,
CancelText, UpdateText properties of the EditCommandColumn to the
appropriate HTML (i.e., <img src=edit.gif>, or what have you).

Yes.
<asp:EditCommandColumn EditText="Edit Info"
visible="true"
ButtonType="PushButton"
UpdateText="Update" CancelText="Cancel" />

Where would I put the imgs? I assume I would take out the EditText,
UpdateText and CancelText. Where would I put it if it were Edit.png,
Update.png and Cancel.png?


<asp:EditCommandColumn EditText="<img src='Edit.png'>" ... />
Where is a good place to find properties for each object (DataGrid,
EditCommandColumn etc)? I am always scrambling to find out how to

set > a background or font property and the names are always different
depending whether you are using CSS or HTML or ASP.NET.


The technical documentation's a good start. If you download the .NET SDK,
or if you have Visual Studio .NET installed on your computer, you have an
offline documentation resource. There's also Google, MSDN, etc. For
example, to find the DataGrid properties just Google using:

site:http://msdn.microsoft.com DataGrid class

http://www.google.com/search?sourcei...DataGrid+class

Whose first link is:
http://msdn.microsoft.com/library/de...ClassTopic.asp


That helps a lot.

Also, if you're going to be doing a lot of work with the DataGrid, might I
suggest you pick up a copy of my book, ASP.NET Data Web Controls Kick
Start? It's 350+ pages on nothin' but the DataGrid, DataList, and
Repeater:

Sample Chapter: http://www.4guysfromrolla.com/webtech/chapters/ASPDWC/
Buy it: http://www.4guysfromrolla.com/aspscr...oto.asp?ID=148
Already have it and use it and really like it.

I was just looking for someway to have at my fingertips a list of properties
and methods of the controls that I can quickly access to get the correct
spelling or format of a particular property. For example: do I use bkground
or background or color or font-color.

Thanks,

Tom
Happy Programming!

--

Scott Mitchell
mi******@4guysfromrolla.com
http://www.4GuysFromRolla.com

* When you think ASP.NET, think 4GuysFromRolla.com!

Nov 18 '05 #5
But guys if i do (Does the image has to be in "PNG" and not "GIF":-

<asp:EditCommandColumn EditText="<img src='Edit.png'>" />

it works but when i DO

<asp:EditCommandColumn
HeaderText="Editing"
EditText="<img src='im_cancel.gif'>"
UpdateText="Update"
CancelText="Cancel"
ButtonType="PushButton" />
IT DOESN"T?


"tshad" wrote:
"Scott Mitchell [MVP]" <mi******@4guysfromrolla.com> wrote in message
news:41**************@4guysfromrolla.com...
tshad wrote:
"Scott Mitchell [MVP]" <mi******@4guysfromrolla.com> wrote in message
news:41************@4guysfromrolla.com...

tshad wrote:

>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.

Tom, are you using an EditCommandColumn for the Edit/Update/Cancel
buttons in the DataGrid, and are wanting to replace those with a custom
image file? If this is the case, all you have to do is set the EditText,
CancelText, UpdateText properties of the EditCommandColumn to the
appropriate HTML (i.e., <img src=edit.gif>, or what have you).
Yes.
<asp:EditCommandColumn EditText="Edit Info"
visible="true"
ButtonType="PushButton"
UpdateText="Update" CancelText="Cancel" />

Where would I put the imgs? I assume I would take out the EditText,
UpdateText and CancelText. Where would I put it if it were Edit.png,
Update.png and Cancel.png?


<asp:EditCommandColumn EditText="<img src='Edit.png'>" ... />
Where is a good place to find properties for each object (DataGrid,
EditCommandColumn etc)? I am always scrambling to find out how to

set > a background or font property and the names are always different
depending whether you are using CSS or HTML or ASP.NET.


The technical documentation's a good start. If you download the .NET SDK,
or if you have Visual Studio .NET installed on your computer, you have an
offline documentation resource. There's also Google, MSDN, etc. For
example, to find the DataGrid properties just Google using:

site:http://msdn.microsoft.com DataGrid class

http://www.google.com/search?sourcei...DataGrid+class

Whose first link is:
http://msdn.microsoft.com/library/de...ClassTopic.asp


That helps a lot.

Also, if you're going to be doing a lot of work with the DataGrid, might I
suggest you pick up a copy of my book, ASP.NET Data Web Controls Kick
Start? It's 350+ pages on nothin' but the DataGrid, DataList, and
Repeater:

Sample Chapter: http://www.4guysfromrolla.com/webtech/chapters/ASPDWC/
Buy it: http://www.4guysfromrolla.com/aspscr...oto.asp?ID=148


Already have it and use it and really like it.

I was just looking for someway to have at my fingertips a list of properties
and methods of the controls that I can quickly access to get the correct
spelling or format of a particular property. For example: do I use bkground
or background or color or font-color.

Thanks,

Tom

Happy Programming!

--

Scott Mitchell
mi******@4guysfromrolla.com
http://www.4GuysFromRolla.com

* When you think ASP.NET, think 4GuysFromRolla.com!


Nov 18 '05 #6
So it only works if the ButtonType is type LinkButton Not PushButton
Well all good!
"Patrick.O.Ige" wrote:
But guys if i do (Does the image has to be in "PNG" and not "GIF":-

<asp:EditCommandColumn EditText="<img src='Edit.png'>" />

it works but when i DO

<asp:EditCommandColumn
HeaderText="Editing"
EditText="<img src='im_cancel.gif'>"
UpdateText="Update"
CancelText="Cancel"
ButtonType="PushButton" />
IT DOESN"T?


"tshad" wrote:
"Scott Mitchell [MVP]" <mi******@4guysfromrolla.com> wrote in message
news:41**************@4guysfromrolla.com...
tshad wrote:
> "Scott Mitchell [MVP]" <mi******@4guysfromrolla.com> wrote in message
> news:41************@4guysfromrolla.com...
>
>>tshad wrote:
>>
>>>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.
>>
>>Tom, are you using an EditCommandColumn for the Edit/Update/Cancel
>>buttons in the DataGrid, and are wanting to replace those with a custom
>>image file? If this is the case, all you have to do is set the EditText,
>>CancelText, UpdateText properties of the EditCommandColumn to the
>>appropriate HTML (i.e., <img src=edit.gif>, or what have you).
>
>
> Yes.
> <asp:EditCommandColumn EditText="Edit Info"
> visible="true"
> ButtonType="PushButton"
> UpdateText="Update" CancelText="Cancel" />
>
> Where would I put the imgs? I assume I would take out the EditText,
> UpdateText and CancelText. Where would I put it if it were Edit.png,
> Update.png and Cancel.png?

<asp:EditCommandColumn EditText="<img src='Edit.png'>" ... />

> Where is a good place to find properties for each object (DataGrid,
> EditCommandColumn etc)? I am always scrambling to find out how to
set > a background or font property and the names are always different
> depending whether you are using CSS or HTML or ASP.NET.

The technical documentation's a good start. If you download the .NET SDK,
or if you have Visual Studio .NET installed on your computer, you have an
offline documentation resource. There's also Google, MSDN, etc. For
example, to find the DataGrid properties just Google using:

site:http://msdn.microsoft.com DataGrid class

http://www.google.com/search?sourcei...DataGrid+class

Whose first link is:
http://msdn.microsoft.com/library/de...ClassTopic.asp


That helps a lot.

Also, if you're going to be doing a lot of work with the DataGrid, might I
suggest you pick up a copy of my book, ASP.NET Data Web Controls Kick
Start? It's 350+ pages on nothin' but the DataGrid, DataList, and
Repeater:

Sample Chapter: http://www.4guysfromrolla.com/webtech/chapters/ASPDWC/
Buy it: http://www.4guysfromrolla.com/aspscr...oto.asp?ID=148


Already have it and use it and really like it.

I was just looking for someway to have at my fingertips a list of properties
and methods of the controls that I can quickly access to get the correct
spelling or format of a particular property. For example: do I use bkground
or background or color or font-color.

Thanks,

Tom

Happy Programming!

--

Scott Mitchell
mi******@4guysfromrolla.com
http://www.4GuysFromRolla.com

* When you think ASP.NET, think 4GuysFromRolla.com!


Nov 18 '05 #7
I find that it works, but it also puts a blue border around it for some
reason.

If I have it as an imagebutton it looks fine with no border around it:

<asp:ImageButton ID="ExpandButton" runat="server"
Font-Size="2" ImageUrl="../images/edit.png" Width="16" Height="16"
CommandName="Select" AlternateText="Click here to see
details"></asp:ImageButton>

If I have it as part of the EditCommandColumn I get this blue border. The
background colors are grey and orange that alternate.

<asp:EditCommandColumn EditText="<img
src='..\images\Edit.png' >" visible="true"
ButtonType="LinkButton"
UpdateText="<img src='..\images\update.png'>"
CancelText="<img src='..\images\Cancel.png'>" />

The background colors are exactly the same for the ImageButton.

There is no border if I use the normal edittext button.

Why the border?

Thanks,

Tom.

"Patrick.O.Ige" <Pa*********@discussions.microsoft.com> wrote in message
news:C9**********************************@microsof t.com...
So it only works if the ButtonType is type LinkButton Not PushButton
Well all good!
"Patrick.O.Ige" wrote:
But guys if i do (Does the image has to be in "PNG" and not "GIF":-

<asp:EditCommandColumn EditText="<img src='Edit.png'>" />

it works but when i DO

<asp:EditCommandColumn
HeaderText="Editing"
EditText="<img src='im_cancel.gif'>"
UpdateText="Update"
CancelText="Cancel"
ButtonType="PushButton" />
IT DOESN"T?


"tshad" wrote:
> "Scott Mitchell [MVP]" <mi******@4guysfromrolla.com> wrote in message
> news:41**************@4guysfromrolla.com...
> > tshad wrote:
> >> "Scott Mitchell [MVP]" <mi******@4guysfromrolla.com> wrote in
> >> message
> >> news:41************@4guysfromrolla.com...
> >>
> >>>tshad wrote:
> >>>
> >>>>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.
> >>>
> >>>Tom, are you using an EditCommandColumn for the Edit/Update/Cancel
> >>>buttons in the DataGrid, and are wanting to replace those with a
> >>>custom
> >>>image file? If this is the case, all you have to do is set the
> >>>EditText,
> >>>CancelText, UpdateText properties of the EditCommandColumn to the
> >>>appropriate HTML (i.e., <img src=edit.gif>, or what have you).
> >>
> >>
> >> Yes.
> >> <asp:EditCommandColumn EditText="Edit Info"
> >> visible="true"
> >> ButtonType="PushButton"
> >> UpdateText="Update" CancelText="Cancel" />
> >>
> >> Where would I put the imgs? I assume I would take out the EditText,
> >> UpdateText and CancelText. Where would I put it if it were
> >> Edit.png,
> >> Update.png and Cancel.png?
> >
> > <asp:EditCommandColumn EditText="<img src='Edit.png'>" ... />
> >
> > > Where is a good place to find properties for each object (DataGrid,
> > > EditCommandColumn etc)? I am always scrambling to find out how to
> > set > a background or font property and the names are always
> > different
> > > depending whether you are using CSS or HTML or ASP.NET.
> >
> > The technical documentation's a good start. If you download the .NET
> > SDK,
> > or if you have Visual Studio .NET installed on your computer, you
> > have an
> > offline documentation resource. There's also Google, MSDN, etc. For
> > example, to find the DataGrid properties just Google using:
> >
> > site:http://msdn.microsoft.com DataGrid class
> >
> > http://www.google.com/search?sourcei...DataGrid+class
> >
> > Whose first link is:
> > http://msdn.microsoft.com/library/de...ClassTopic.asp
>
> That helps a lot.
>
> >
> > Also, if you're going to be doing a lot of work with the DataGrid,
> > might I
> > suggest you pick up a copy of my book, ASP.NET Data Web Controls Kick
> > Start? It's 350+ pages on nothin' but the DataGrid, DataList, and
> > Repeater:
> >
> > Sample Chapter:
> > http://www.4guysfromrolla.com/webtech/chapters/ASPDWC/
> > Buy it: http://www.4guysfromrolla.com/aspscr...oto.asp?ID=148
>
> Already have it and use it and really like it.
>
> I was just looking for someway to have at my fingertips a list of
> properties
> and methods of the controls that I can quickly access to get the
> correct
> spelling or format of a particular property. For example: do I use
> bkground
> or background or color or font-color.
>
> Thanks,
>
> Tom
> >
> > Happy Programming!
> >
> > --
> >
> > Scott Mitchell
> > mi******@4guysfromrolla.com
> > http://www.4GuysFromRolla.com
> >
> > * When you think ASP.NET, think 4GuysFromRolla.com!
>
>
>

Nov 18 '05 #8
Hi Tom,
You are right.But if you don't want the border do border='0' like
below.
Patrick
<asp:EditCommandColumn EditText="<img
src='..\images\Edit.png' >" visible="true"
ButtonType="LinkButton"
UpdateText="<img src='..\images\update.png' border='0'>"
CancelText="<img src='..\images\Cancel.png' border='0'>" />

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #9
"naija naija" <pa*********@crazyjohns.com.au> wrote in message
news:%2******************@TK2MSFTNGP09.phx.gbl...
Hi Tom,
You are right.But if you don't want the border do border='0' like
below.
Patrick
<asp:EditCommandColumn EditText="<img
src='..\images\Edit.png' >" visible="true"
ButtonType="LinkButton"
UpdateText="<img src='..\images\update.png' border='0'>"
CancelText="<img src='..\images\Cancel.png' border='0'>" />

That did it.

Thanks,

Tom.

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

Nov 18 '05 #10

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

Similar topics

1
by: jphelan | last post by:
I am developping a software program that covers a range of nonprofit organization management needs through various modules. I am looking for images/symbols to use with buttons for navigating with....
2
by: Mike P | last post by:
I have a datagrid with a 'Delete' column that the user can click on to delete a row in the datagrid. I thought that I would need to have some kind of error handling in case somebody goes into the...
1
by: Pavel Gusak | last post by:
Hello. I've found DataGrid built-in edit functionality useless. My DataGrid has 9 columns, and is shown just nice until I press 'Edit' on a row. ASP.NET creates 9 TextBoxes, all the same very big...
8
by: sumit | last post by:
Hi, I want to add one java script function on the click of page button of datagrid. But how to get UI control of page button so that i should be able to add attribute for onClick event. ...
0
by: Stewart | last post by:
Sorry for the cross post. Not sure which forum covers these issues: I'm hoping someone can help me figure out what I'm missing in my code. I am trying to configure a Datagrid for editing. So...
5
by: Jeff User | last post by:
Hello ..NET 1.1, VS 2003, C# & asp.net I have tried to follow msdn instructions and samples but I can not get an event to fire for this button on the datagrid. There has to be something obvious...
9
by: William Krick | last post by:
I'm currently using the following custom Stylish style sheet in Firefox 2.0.0.11... *{ color: black !important ; background: none !important; background- color: white !important } a:link {...
4
by: shalini166 | last post by:
I place command button in datagrid. When i click one button in the column.Another form or other datagrid will open. i don't how to make click event for column in the datagrid.please help me. ...
0
by: priyamtheone | last post by:
I have a datagridview with a button column as one of its column collection. The width of the button column is say 50 but the problem is the button editing control within the cell of that column is...
1
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...
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...

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.