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

Need help applying a stylesheet to a pushbutton control in a datagrid

Can anyone help me figure out how to apply a stylesheet to a pushbutton
defined in the asp:BoundColumn or asp:EditCommandColumn elements of a
datagrid?
Nov 18 '05 #1
6 4140
Hi Tim,
Yeah thats a good Question to ask here i did ask a similar Question but no
replies..
Anyway I tried doing this :-

<asp:EditCommandColumn
HeaderText="Editing"
EditText="<input type=submit value=edit style='color:Red'>"
UpdateText="Update"
CancelText="Cancel"
ButtonType="LinkButton"/>
I changed the PushButton to LinkButton but when i applied it
it the event stopped firing!
Let me know how u go..
Patrick
"Tim Meagher" wrote:
Can anyone help me figure out how to apply a stylesheet to a pushbutton
defined in the asp:BoundColumn or asp:EditCommandColumn elements of a
datagrid?

Nov 18 '05 #2
Tim Meagher wrote:
Can anyone help me figure out how to apply a stylesheet to a pushbutton
defined in the asp:BoundColumn or asp:EditCommandColumn elements of a
datagrid?


Tim, check out this FAQ:

Specifying a CssClass for a Button in a ButtonColumn
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 #3
Thx Scott
Would try that out.
"Scott Mitchell [MVP]" wrote:
Tim Meagher wrote:
Can anyone help me figure out how to apply a stylesheet to a pushbutton
defined in the asp:BoundColumn or asp:EditCommandColumn elements of a
datagrid?


Tim, check out this FAQ:

Specifying a CssClass for a Button in a ButtonColumn
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 #4
Hi folks,

I found a simpler way based on another suggestion I ran across. If you
go into the property builder for the datagrid and selection the column
that contains the pushbutton, then you can select at the bottom of the
property builder to change the column to a template. In the template,
the button will be of type "asp:Button" (instead of asp:BoundColumn) to
which you can simply
add the cssClass attribute and specify an external stylesheet.

Here are examples of the result of converting select, remove, edit,
update, cancel, and an editable column to templates and applying the
pertinent cssClass as defined in my external stylesheet:

1. Example of editItem textbox converted to a template
(in the ItemTemplate it is represented by a label,
but in the EditItemTemplate it is represented by a
textbox):

<asp:TemplateColumn HeaderText="Hours">
<ItemTemplate>
<asp:Label CssClass="label" runat="server"
Text='<%# DataBinder.Eval(Container,
"DataItem.Hours") %>'>
</asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox CssClass="textbox" runat="server"
Text='<%# DataBinder.Eval(Container,
"DataItem.Hours") %>'>
</asp:TextBox>
</EditItemTemplate>
</asp:TemplateColumn>
2. Example of edit/update/cancel push buttons that
were converted into a template:

<asp:TemplateColumn>
<ItemTemplate>
<asp:Button CssClass="datagrid" runat="server"
Text="Edit" CommandName="Edit"
CausesValidation="false">
</asp:Button>
</ItemTemplate>
<EditItemTemplate>
<asp:Button CssClass="datagrid" runat="server"
Text="Update" CommandName="Update">
</asp:Button>&nbsp;
<asp:Button CssClass="datagrid" runat="server"
Text="Cancel" CommandName="Cancel"
CausesValidation="false">
</asp:Button>
</EditItemTemplate>
</asp:TemplateColumn>
3. Example of a delete push button that was
converted into a template:

<asp:TemplateColumn>
<ItemTemplate>
<asp:Button CssClass="datagrid" runat="server"
Text="Remove" CommandName="Delete"
CausesValidation="false">
</asp:Button>
</ItemTemplate>
</asp:TemplateColumn>
4. Example of a select push button that was
converted into a template:

<asp:TemplateColumn>
<ItemTemplate>
<asp:Button CssClass="datagrid" runat="server"
Text="Add" CommandName="Select"
CausesValidation="false">
</asp:Button>
</ItemTemplate>
</asp:TemplateColumn>
The Lord Reigns!

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #5
Thanks Tim,
U did a good research thumbs up!
Will try that!
"Tim Meagher" wrote:
Hi folks,

I found a simpler way based on another suggestion I ran across. If you
go into the property builder for the datagrid and selection the column
that contains the pushbutton, then you can select at the bottom of the
property builder to change the column to a template. In the template,
the button will be of type "asp:Button" (instead of asp:BoundColumn) to
which you can simply
add the cssClass attribute and specify an external stylesheet.

Here are examples of the result of converting select, remove, edit,
update, cancel, and an editable column to templates and applying the
pertinent cssClass as defined in my external stylesheet:

1. Example of editItem textbox converted to a template
(in the ItemTemplate it is represented by a label,
but in the EditItemTemplate it is represented by a
textbox):

<asp:TemplateColumn HeaderText="Hours">
<ItemTemplate>
<asp:Label CssClass="label" runat="server"
Text='<%# DataBinder.Eval(Container,
"DataItem.Hours") %>'>
</asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox CssClass="textbox" runat="server"
Text='<%# DataBinder.Eval(Container,
"DataItem.Hours") %>'>
</asp:TextBox>
</EditItemTemplate>
</asp:TemplateColumn>
2. Example of edit/update/cancel push buttons that
were converted into a template:

<asp:TemplateColumn>
<ItemTemplate>
<asp:Button CssClass="datagrid" runat="server"
Text="Edit" CommandName="Edit"
CausesValidation="false">
</asp:Button>
</ItemTemplate>
<EditItemTemplate>
<asp:Button CssClass="datagrid" runat="server"
Text="Update" CommandName="Update">
</asp:Button>
<asp:Button CssClass="datagrid" runat="server"
Text="Cancel" CommandName="Cancel"
CausesValidation="false">
</asp:Button>
</EditItemTemplate>
</asp:TemplateColumn>
3. Example of a delete push button that was
converted into a template:

<asp:TemplateColumn>
<ItemTemplate>
<asp:Button CssClass="datagrid" runat="server"
Text="Remove" CommandName="Delete"
CausesValidation="false">
</asp:Button>
</ItemTemplate>
</asp:TemplateColumn>
4. Example of a select push button that was
converted into a template:

<asp:TemplateColumn>
<ItemTemplate>
<asp:Button CssClass="datagrid" runat="server"
Text="Add" CommandName="Select"
CausesValidation="false">
</asp:Button>
</ItemTemplate>
</asp:TemplateColumn>
The Lord Reigns!

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

Nov 18 '05 #6
Hi Tim,
I tried using ur style in a datagrid but no luck!
Can you give me a hint how i can apply Style to the PushButton below (My
code below)
The Columns are in a Datagrid
Thanks
** Guess 'd understand it better!
:-

<Columns>
<asp:BoundColumn
HeaderText="FileCategoryID"
DataField="FileCategoryID"/>
<asp:BoundColumn
HeaderText="ParentID"
DataField="ParentID"/>

<asp:BoundColumn
HeaderText="FileCategory"
DataField="FileCategory"/>
<asp:BoundColumn
HeaderText="NavigateUrl"
DataField="NavigateUrl"/>
<asp:BoundColumn
HeaderText="target"
DataField="target"/>
<asp:EditCommandColumn
HeaderText="Editing"
EditText="Edit"
UpdateText="Update"
CancelText="Cancel"
ButtonType="PushButton" />

</Columns>

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

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

Similar topics

1
by: Danky | last post by:
Hello Everybody, How Can I Enable Edit some columns on Control Datagrid and lock edit others? Is it posible on Control DataGRid of VB.Net? I Accept some link, example or any resource. ...
2
by: Carolyn Vo | last post by:
I have been looking and looking but can't seem to find out how to get the row selected in a web control datagrid (NOT a web form datagrid!!!), and how to highlight the selected row. I'm sure this...
5
by: Luis E Valencia | last post by:
I need a link on a datagrid, the link must have fields of the database Like this acciones.aspx?iddireccion=1&idindicador=4 Thanks
4
by: active | last post by:
It appears to me that if I change the Control's client size the controls size does not change to agree with the new size. Does it work like the VB6 ScaleWidth and ScaleHeight? That is after I...
7
by: sasquatch | last post by:
Hi, I've a a site with nested master pages and content pages. I tried using a theme with a stylesheet in the app_themes directory referencing it in the web.config file from a pages tag theme...
2
by: VancouverMike | last post by:
Hi there, I am using a datagrid in my asp.net web app to show a user list. I put a pushbutton (could be linkbutton as well) for each row in the grid. I would like to have a javascript function...
1
by: Blasting Cap | last post by:
I am having trouble changing the font for a PushButton control in a datagrid button column. I have seen several posts refer to styles and simple changes to the HTML for font changes but most of...
1
by: =?Utf-8?B?ZGF2aWQ=?= | last post by:
in web form design (C#), I draged a datagrid onto web form, called grdFiles, and set aotuGenerateColumns property to FALSE. Use the following to populate data into the datagrid: //...
6
pradeepjain
by: pradeepjain | last post by:
Hii guys, i am generating a php mail like this $message = ' <html> <head> <style type="text/css" media="all">@import "/themes/admitcard.css";</style> <title>Birthday Reminders...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
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
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
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...

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.