resize bound textbox to datagrid


I'm having a problem resizing the controls width (textbox). When user clicks the datagrid, a textbox will appear for editing purposes, i'm not sure where the textbox is located, i think it's bound to the datagrid?

Please kindly guide me to resize the textbox when it appears.

ItemStyle-Width="40px" <-----------this one resizes the datagrid column only, we need the textbox..

>><asp:BoundColumn DataField="break1" HeaderText="First Break"></asp:BoundColumn><<


                    <asp:DataGrid id="DataGrid1" runat="server" Font-Names="Verdana" Font-Size="XX-Small" DataKeyField="operatorshiftid" AutoGenerateColumns="False" CellPadding="4" onPageIndexChanged="pageGrid" AllowPaging="True" PageSize="50" OnDeleteCommand="manage_delete" OnUpdateCommand="manage_update" OnCancelCommand="manage_cancel_edit" OnEditCommand="manage_edit" OnItemDataBound="manage_ItemDataBound">
                <HeaderStyle font-bold="True"></HeaderStyle>
                    <asp:BoundColumn DataField="operatorid" ReadOnly="True" HeaderText="Operator ID"></asp:BoundColumn>
                    <asp:BoundColumn DataField="operatorname" ReadOnly="True" HeaderText="Operator Name"></asp:BoundColumn>
                    <asp:BoundColumn DataField="shiftdate" ReadOnly="True" HeaderText="Shift Date"></asp:BoundColumn>
                    <asp:TemplateColumn HeaderText="Start Time">
                            <%# Container.DataItem("starttime")%>
                            <asp:Label id="lblSelected1" visible="false" text=<%# DataBinder.Eval(Container.DataItem, "starttime") %> runat="server"/>
                            <asp:DropDownList ID="DropDownList1" runat="server" />
                    <asp:BoundColumn DataField="break1" HeaderText="First Break"></asp:BoundColumn>
                    <asp:BoundColumn DataField="lunch" HeaderText="Lunch Break"></asp:BoundColumn>
                    <asp:BoundColumn DataField="break2" HeaderText="Second Break"></asp:BoundColumn>
                    <asp:BoundColumn DataField="endtime" ReadOnly="True" HeaderText="End Time"></asp:BoundColumn>
                    <asp:EditCommandColumn ButtonType="LinkButton" UpdateText="Update" CancelText="Cancel" EditText="Edit"></asp:EditCommandColumn>
                    <asp:ButtonColumn Text="Delete" CommandName="Delete"></asp:ButtonColumn>
                <PagerStyle horizontalalign="Right" position="TopAndBottom" pagebuttoncount="20" mode="NumericPages"></PagerStyle>
Who is Participating?
Step 1)  Convert all your edit columns to Template Columns.  You can do this by right click on the datagrid > property builder > columns > click on the column > "Convert to Template Column"

Step 2) Right click datagrid > Edit Template > Select your column > when the textbox appears drag it to desired width or specify new width in properties window
lynntonAuthor Commented:

Step 1 is done.

I'm not able to accomplish step 2, don't see any edit template

Hi lynnton,

If you go to the HTML view and have a look for the <Columns> section of your datagrid.  Look for the <asp:TemplateColumn> tag then under that you should see <ItemTemplate>.  Look for a <EditItemTemplate> tag at the same level as the <ItemTemplate> tag.  If there isn't one, add one.  Here you can add the controls for your edit command!

Hope this is of some help,

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.