Click here to Skip to main content
15,908,768 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi,
i am working on a project which has a datagrid,wihtin this datagrid i have 1 delete button and 1 edit botton.After clicking edit the text within the datagrid becomes available for editing Like a textbox wherein user can update or edit the existing record.
My problem is that this datagrid textbox is not wide enough to view entire line within the textbox hence i want to increase this textbox after user clicks on Edit button.

kindly help me for the same.
Posted

in the Edit Item Template

XML
<EditItemTemplate>
 <asp:TextBox ID="txtId" runat="server" Width="80%" Height="50%"></asp:TextBox> </EditItemTemplate>


give the width and height as Required

or If You have Edit button outside of gridview then.

find that Txtbox control in Gridview and

Txtbox.width="As Required";
 
Share this answer
 
Comments
RaviRanjanKr 11-Apr-11 0:59am    
Nice Answer! My 5 :)
Mahendra.p25 11-Apr-11 1:02am    
Thanks
Vandana87 11-Apr-11 1:38am    
my datagrid code is as follows -

<asp:EditCommandColumn EditText="Edit" HeaderText="Edit" CancelText="Cancel" UpdateText="Update/">

your solution didnt work for me plz guide me for same which is possible in this case.
You can add width and height as mentioned in the above post. However as per the best practices, you should use CSS rather then static hight/width dimension.

1. Create a CSS class with required height and weidth
2. Apply that CSS in textbox. You can also re-use the same CSS for other pages/other DataGrid also.
3. Now in future if you need to change the textbox size again, then you only need to change it in CSS file and not in whole project.

For more details regarding CSS and examples please click here[^]
 
Share this answer
 
Comments
Vandana87 11-Apr-11 2:34am    
my datagrid code is as follows -

<asp:EditCommandColumn EditText="Edit" HeaderText="Edit" CancelText="Cancel" UpdateText="Update/">

your solution didnt work for me plz guide me for same which is possible in this case without css plz
.

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