GridTextBoxColumnEditor Width

3 posts, 1 answers
  1. Geoff
    Geoff avatar
    53 posts
    Member since:
    Aug 2012

    Posted 05 Nov 2013 Link to this post

    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. Answer
    Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 05 Nov 2013 Link to this post

    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

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Geoff
    Geoff avatar
    53 posts
    Member since:
    Aug 2012

    Posted 05 Nov 2013 Link to this post

    Princy,
        Many thanks for the prompt reply. Oops! I missed that, works fine now.

    Regards

    Geoff
Back to Top