469,890 Members | 1,425 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,890 developers. It's quick & easy.

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 4393
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by jphelan | last post: by
2 posts views Thread by Mike P | last post: by
1 post views Thread by Pavel Gusak | last post: by
8 posts views Thread by sumit | last post: by
reply views Thread by Stewart | last post: by
5 posts views Thread by Jeff User | last post: by
1 post views Thread by Waqarahmed | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.