• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 581
  • Last Modified:

resize bound textbox to datagrid

Hi,

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><<



Thanks.


                    <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>
                <Columns>
                    <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">
                        <ItemTemplate>
                            <%# Container.DataItem("starttime")%>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:Label id="lblSelected1" visible="false" text=<%# DataBinder.Eval(Container.DataItem, "starttime") %> runat="server"/>
                            <asp:DropDownList ID="DropDownList1" runat="server" />
                        </EditItemTemplate>
                    </asp:TemplateColumn>
                    <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>
                </Columns>
                <PagerStyle horizontalalign="Right" position="TopAndBottom" pagebuttoncount="20" mode="NumericPages"></PagerStyle>
            </asp:DataGrid>
0
lynnton
Asked:
lynnton
2 Solutions
 
Type25Commented:
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
0
 
lynntonAuthor Commented:
Type25,

Step 1 is done.

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

Thanks.
0
 
w3timCommented:
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,

Tim
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now