This is a migrated thread and some comments may be shown as answers.

GridTextBoxColumnEditor Width

2 Answers 188 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Geoff
Top achievements
Rank 1
Geoff asked on 05 Nov 2013, 09:34 AM
Hi, I have a RadGrid that is basically copied from the Batch Editing demo (FYI, I'm a Telerik newbie). Functionally it all works great and I was pleased with how quickly I was able to convert the demo to suit me needs. However, I have one small issue with the GridTextBoxColumnEditor control width. No matter what I try to set in the aspx code, the text box width is resolutely fixed at what looks to be 100px-150px.
In the code sample I've included below, the textbox width is set to 200px. I can change this to 2px or 2000px or just delete the line altogether. It makes no difference. Could anyone help please?
<telerik:RadWindowManager ID="RadWindowManager1" runat="server" EnableShadow="true"></telerik:RadWindowManager>
 
<telerik:RadAjaxPanel runat="server" ID="RadAjaxPanel1">
    <telerik:RadGrid ID="RadGrid1" DataSourceID="ds_ActivityCodes" AutoGenerateColumns="False" AllowSorting="True"
        AllowAutomaticDeletes="False" AllowAutomaticInserts="True" AllowAutomaticUpdates="True"
        AllowPaging="True" GridLines="None" PageSize="10" Width="750px" runat="server">
 
        <MasterTableView CommandItemDisplay="TopAndBottom" DataKeyNames="activity_id"
            DataSourceID="ds_ActivityCodes" HorizontalAlign="NotSet" EditMode="Batch" AutoGenerateColumns="False">
 
            <CommandItemSettings ShowSaveChangesButton="false" />
 
            <BatchEditingSettings EditType="Cell" OpenEditingEvent="None" />
 
            <SortExpressions>
                <telerik:GridSortExpression FieldName="ActivityCode" SortOrder="Ascending" />
            </SortExpressions>
 
            <Columns>
                <telerik:GridBoundColumn DataField="ActivityCode" HeaderStyle-Width="60px" HeaderText="Activity Code" SortExpression="ActivityCode" UniqueName="ActivityCode">
                    <ColumnValidationSettings EnableRequiredFieldValidation="true">
                        <RequiredFieldValidator ForeColor="Red" Text="*This field is required">
                        </RequiredFieldValidator>
                    </ColumnValidationSettings>
                </telerik:GridBoundColumn>
 
                <telerik:GridBoundColumn DataField="ActivityDescription" HeaderStyle-Width="210px" HeaderText="Description" SortExpression="ActivityDescription" UniqueName="ActivityDescription">
                    <ColumnValidationSettings EnableRequiredFieldValidation="true">
                        <RequiredFieldValidator ForeColor="Red" Text="*This field is required">
                        </RequiredFieldValidator>
                    </ColumnValidationSettings>
                </telerik:GridBoundColumn>
 
                <telerik:GridCheckBoxColumn DataField="display" HeaderStyle-Width="60px" HeaderText="Display" SortExpression="display" UniqueName="display" >
                </telerik:GridCheckBoxColumn>
            </Columns>
 
        </MasterTableView>
    </telerik:RadGrid>
 
    <telerik:GridTextBoxColumnEditor runat="server" ID="TextEditor">
        <TextBoxStyle Width="200px" />
    </telerik:GridTextBoxColumnEditor>
 
    <telerik:GridCheckBoxColumnEditor runat="server" ID="CheckBoxEditor">
        <CheckBoxStyle Width="20px" />
    </telerik:GridCheckBoxColumnEditor>
</telerik:RadAjaxPanel>

2 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 1
answered on 05 Nov 2013, 10:57 AM
Hi Geoff,

Please set the ColumnEditorID for the GridBoundColumn which corressponds to the ID of the GridTextBoxColumnEditor. Please try the following code snippet.

ASPX:
<telerik:GridBoundColumn DataField="QuantityPerUnit" HeaderText="Quantity Per Unit"
UniqueName="QuantityPerUnit" ColumnEditorID="TextEditor">
</telerik:GridBoundColumn>
 
<telerik:GridTextBoxColumnEditor runat="server" ID="TextEditor">
  <TextBoxStyle Width="100px" />
</telerik:GridTextBoxColumnEditor>

Thanks,
Princy

0
Geoff
Top achievements
Rank 1
answered on 05 Nov 2013, 11:07 AM
Princy,
    Many thanks for the prompt reply. Oops! I missed that, works fine now.

Regards

Geoff
Tags
Grid
Asked by
Geoff
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 1
Geoff
Top achievements
Rank 1
Share this question
or