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

Need to reduce the size of the Textbox

2 Answers 175 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Anto (DLL Version : 2008.3.1314.35)
Top achievements
Rank 2
Anto (DLL Version : 2008.3.1314.35) asked on 09 Jul 2013, 02:02 PM
Hi,

Have a Grid with EditMode ="InPlace" and AutoGenerateColumn= "true".

Need to reduce the size of the Textbox in EditMode.

<telerik:RadGrid ID="RadGridSingleClick" runat="server" Skin="Vista" AutoGenerateColumns="true"
                    OnNeedDataSource="RadGridSingleClick_NeedDataSource" OnPreRender="RadGridSingleClick_PreRender"
                    OnUpdateCommand="RadGridSingleClick_UpdateCommand" OnColumnCreated="RadGridSingleClick_ColumnCreated"  Height="250px" Width="1000px">
                    <%--OnItemDataBound="RadGridText_ItemDataBound" --%>
                    <MasterTableView HeaderStyle-CssClass="disable-highlight" Width="98%" HeaderStyle-HorizontalAlign="Center"
                        HeaderStyle-Wrap="true" DataKeyNames="MKTID" HeaderStyle-Width="100px" ItemStyle-Width="50px" EditMode="InPlace">
                        <Columns>
                        <telerik:GridEditCommandColumn ButtonType="ImageButton" ItemStyle-Width="60px" HeaderStyle-Width="60px"></telerik:GridEditCommandColumn>
                        </Columns>
                    </MasterTableView>
                    <ClientSettings Scrolling-AllowScroll="true" Resizing-AllowColumnResize="true" Scrolling-SaveScrollPosition="true"
                        Scrolling-FrozenColumnsCount="2" Scrolling-UseStaticHeaders="true">
                        <Selecting AllowRowSelect="true" />
                        <ClientEvents OnRowClick="RadGridSingleRowClick" />
                        <Scrolling AllowScroll="true" UseStaticHeaders="true" />
                    </ClientSettings>                    
                </telerik:RadGrid>

Have attached the screen shot too.

Thank You.

-Anto

2 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 10 Jul 2013, 06:46 AM
Hi Anto,

Please try setting the width of the textbox in editmode inside prerender event of the radgrid.Here is the sample i have tried to set the width for autogenerated bound columns.

C#:
protected void RadGrid1_PreRender(object sender, EventArgs e)
{
    foreach (GridEditableItem edititem in RadGrid1.MasterTableView.GetItems(GridItemType.EditItem))
    {
        foreach (GridColumn col in RadGrid1.MasterTableView.RenderColumns)
        {
            if (col.ColumnType == "GridBoundColumn")//Checking for BoundColumn
            {
                if (edititem.IsInEditMode)
                {
                    TextBox txtbx = (TextBox)edititem[col.UniqueName].Controls[0];
                    txtbx.Width = Unit.Pixel(10); //Setting width
                }
            }
        }
    }
}

Thanks,
Princy
0
Anto (DLL Version : 2008.3.1314.35)
Top achievements
Rank 2
answered on 10 Jul 2013, 10:47 AM
Hi Princy,

Thank You, it worked.

Have one more issue. While edit the last Column cannot be viewed properly.

The last column in "Shopping Mall". but can only view "Shop".

One more thing, in the textboxes only numbers should be entered, Is there any validation for this.

Have attached the screen shot

-Anto

Tags
Grid
Asked by
Anto (DLL Version : 2008.3.1314.35)
Top achievements
Rank 2
Answers by
Princy
Top achievements
Rank 2
Anto (DLL Version : 2008.3.1314.35)
Top achievements
Rank 2
Share this question
or