gridview question

  • Thread starter Thread starter Jon Paal
  • Start date Start date
J

Jon Paal

how to set the width of BoundField textbox when it is displayed in edit mode ?
 
i do this in code if you need to do it dynamicly. Try this, i have not tested
this, but it should work. Please let me know.

use the rowediting event to find the text box and then set the width.
Protected Sub GridView1_RowEditing(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.GridViewEditEventArgs) Handles GridView1.RowEditing
Dim tb As TextBox =
Me.GridView1.Rows(Me.GridView1.SelectedIndex).Cells(3).FindControl("mytextbox")

tb.Width = 75
End Sub
you need to know the cell number and the name of the text box where your
template field is.
Try this
 
on second pass, I can't get my sode to work eather. Should have tried this
first.
if you do find the answer i would really like to know!
thanks and appologies for the untesed answer
 
it's not a template field it's a bound field.

I resolved the problem by using an external css file setting the html input tag to a specified width.

thanks for trying.
 
thanks for trying

I am using a bound field not a template filed.

I resolved the problem by using an external css file setting the input tag to a specified width
 
for what it's worth you can just set the width of the text box after you
convert it to a template field. It is not dynamic, but it may do what you want
1. convert column to a template
2. select edit templates
3. select the edit template
4. change the width property
thanks
and sorry again about the previous answer.
 

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

Back
Top