Click here to Skip to main content
15,300,338 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Referring GridView.RowEditing Event[^], I added Editing function dynamically to a GridView.

After I clicked the edit on a row of the GridView, the text in the row becomes editable.

The problem is that the TextBox that holds the text to be edited is too small.
I want to size it as long as the Gridview's column.

How to do it?

Thanks in advance for your advice.
Posted
v2

On the GridView Mark up code in aspx page, try to put inline or css styles to change the size of GridView and the TextBoxes inside that.
hii
Why dont u set width property of textbox on databound event of grid like

if(e.item is isEditable or isEdititem)
{
Textbox1.width=""
}

You can also set width property in edit itemtemplete in aspx page if u r using templete column for that column.
   
v2
Comments
[no name] 1-Nov-13 10:24am
   
To Tadit Dash: Thanks for your post. Since the GridView dynamically binds data, I am not sure the Mark-up code can solve this problem. Besides, I don't know how to do it.
To Rahul_Pandit: Thanks for your hint. In the aspx., I clicked the Edit control, GridView0_SelectedIndexChanged() event popped out for me to add code. I coded like that:
for (int i = 0; i < GridView0.Rows.Count; i++) {
GridViewRow row = GridView0.Rows[i];
((TextBox)(row.Cells[1].Controls[0])).Width = 2500;
((TextBox)(row.Cells[1].Controls[0])).Height = 2500;
}
It got some improvement but still not enough. I am still woking on it. However, your feedback is creditable as "Accept Solution". Thanks.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900