CSS and textbox size

  • Thread starter Thread starter Maziar Aflatoun
  • Start date Start date
M

Maziar Aflatoun

Hi everyone,

I have the following EditCommandColumn

<Columns>

<asp:BoundColumn DataField="Qty" HeaderText="Qty"
HeaderStyle-Font-Bold="True" HeaderStyle-CssClass="normtext"
ItemStyle-CssClass="normtext"></asp:BoundColumn>

<asp:EditCommandColumn ButtonType="LinkButton" EditText="Edit"
CancelText="Cancel" UpdateText="Update"
HeaderStyle-CssClass="normtext" ItemStyle-Wrap="false" HeaderText="Edit"
HeaderStyle-Wrap="false" HeaderStyle-Font-Bold="True" />
</Columns>

How do I assign a CSS tag to the hyperlinks 'Edit' and once clicked 'Update'
and 'Cancel' in my datagrid rows? Also, once the user clicks edit on a row
it creates a textbox for users to input their Qty value. How do I set the
TextBox width in that row?

Thank you
Maziar A.
 
Sorry about the previous post.
Change your code to something like this

<Columns>

<asp:BoundColumn DataField="Qty" HeaderText="Qty"
HeaderStyle-Font-Bold="True" HeaderStyle-CssClass="normtext"
ItemStyle-CssClass="normtext"></asp:BoundColumn>

<asp:EditCommandColumn ButtonType="LinkButton" EditText="<div
class='ClassNameHere'>Edit</div>"
CancelText="<div class='ClassNameHere'>Cancel</div>" UpdateText="Update"
HeaderStyle-CssClass="normtext" ItemStyle-Wrap="false" HeaderText="Edit"
HeaderStyle-Wrap="false" HeaderStyle-Font-Bold="True" />
</Columns>


You can even go one step ahead and use an <b>image</b> like this.

<Columns>

<asp:BoundColumn DataField="Qty" HeaderText="Qty"
HeaderStyle-Font-Bold="True" HeaderStyle-CssClass="normtext"
ItemStyle-CssClass="normtext"></asp:BoundColumn>

<asp:EditCommandColumn ButtonType="LinkButton" EditText="<img
src='images/editimage.gif' border=0 class='ClassNameHere'/>"
CancelText="<img src='images/cancelimage.gif' border=0
class='ClassNameHere'/>" UpdateText="Update"
HeaderStyle-CssClass="normtext" ItemStyle-Wrap="false" HeaderText="Edit"
HeaderStyle-Wrap="false" HeaderStyle-Font-Bold="True" />
</Columns>

HTH

Trevor Benedict R
MCSD


*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
 
and as for the width of the TextBox you can use the designer to Edit the
control or go to the SOurce View in VS.NET and add the WIDTH attribute
to the template column where you have the Textbox declared.

For more sample you can also visit http://www.datagridgirl.com

Trevor Benedict R
MCSD

*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
 
Hi,

Thanks for your help. But it still doesn't work and I think it's because the
css appears inside the Edit tag.

<a
href="javascript:__doPostBack('ShoppingCart1$DGShoppingCart$_ctl2$_ctl0','')"><div
class='linksmall'>Edit</div></a>

Is there anyway to add the css to <a href="..."... > tag?

Thanks
Maz.
 
I forgot something. Use this code snippet instead

<Columns>

<asp:BoundColumn DataField="Qty" HeaderText="Qty"
HeaderStyle-Font-Bold="True" HeaderStyle-CssClass="normtext"
ItemStyle-CssClass="normtext"></asp:BoundColumn>

<asp:EditCommandColumn ButtonType="LinkButton" edittext="&lt;img
src='images/editimage.gif' border=0 class='ClassNameHere'&gt;"
canceltext="&lt;img src='images/cancelimage.gif' border=0
class='ClassNameHere'&gt;" UpdateText="Update"
HeaderStyle-CssClass="normtext" ItemStyle-Wrap="false" HeaderText="Edit"
HeaderStyle-Wrap="false" HeaderStyle-Font-Bold="True" />
</Columns>

Regards,

Trevor Benedict R
MCSD

*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
 
Back
Top