GridView Edit Template Control Style

M

Morris Neuman

Hi,
I have a gridview and have set the font size to 8pt and forecolor to navy.

When I set the editrowstyle to different values it works for labels in edit
template mode, but not for textboxes, dropdownlist or other controls. Do I
have to set the style for each control individually? I only want the
different style to affect the controls in edit template mode.
 
A

Allen Chen [MSFT]

Hi Morris,

To do this you can set CssClass for the EditRowStyle.

CSS:

<style type="text/css">
.test input{ background-color:Red;}
.test select { background-color:Green;}
</style>


aspx:

<asp:GridView ...
<EditRowStyle CssClass="test" />
...

ASP.NET TextBox control renders <input> to the client side. ASP.NET
DropDownList control renders <select> to the client side. So the above
styles will apply to the elements rendered by them. You can view source of
the page to see what HTML tags are rendered by ASP.NET controls to see how
to set correct CSS for them.

Please have a try and let me know if it works.

Regards,
Allen Chen
Microsoft Online Support
 
A

Allen Chen [MSFT]

Hi Morris,

Can my code work?

Regards,
Allen Chen
Microsoft Online Support
 
A

Allen Chen [MSFT]

A

Allen Chen [MSFT]

Hi Morris,

Have you solved this issue?

Regards,
Allen Chen
Microsoft Online Community Support
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top