Batch Edit TxtBox width

8 posts, 0 answers
  1. vadim
    vadim avatar
    3 posts
    Member since:
    Sep 2014

    Posted 02 Nov 2014 Link to this post

    Hello,
    What can be the reason for the textbox in the Batch Edit mode  to be wider than a column itself (like in the attached image)?

    Thank you,
    Vadim
  2. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 05 Nov 2014 Link to this post

    Hi Vadim,

    The presented issue is not an expected behavior in a sample batch editing configuration and could not be replicated on our side. You can test the online demo below that works properly:

    http://demos.telerik.com/aspnet-ajax/grid/examples/data-editing/batch-editing/defaultcs.aspx

    Therefore it appears that the issue is related to your specific custom scenario. In such case it will be best if you can share your page markup as well as related code behind so that we can further investigate the presented issue.

    Regards,
    Maria Ilieva
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Warren
    Warren avatar
    24 posts
    Member since:
    May 2008

    Posted 18 Dec 2014 in reply to Maria Ilieva Link to this post

    I'm having this same exact problem.  I'm having trouble figuring out why because the demo appears to work find.  Although the difference in the demo is the div tag has a style class on it so I'm not sure what style is applied. 

    <div id="demo" class="demo-container no-bg">

    Could this be the reason?

    Here's my entire page I created for testing.  The data is retrieved on the code behind via a stored procedure call.

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm2.aspx.cs" Inherits="TestWebApp.WebForm2" %>
     
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
     
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
        <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
        <div>
            <telerik:radgrid ID="rgListItems" runat="server" AutoGenerateColumns="false" GridLines="None"
                                Skin="Office2010Blue" AllowPaging="false" AllowSorting="true" Width="700px"
                                OnNeedDataSource="rgListItems_NeedDataSource">
                <MasterTableView CommandItemDisplay="Top" EditMode="Batch" HorizontalAlign="NotSet" DataKeyNames="CustomListingId" ClientDataKeyNames="SortOrder" AutoGenerateColumns="false">
                    <CommandItemSettings ShowAddNewRecordButton="true" ShowCancelChangesButton="true" ShowRefreshButton="true" ShowSaveChangesButton="false" />
                    <BatchEditingSettings EditType="Cell" />
                    <SortExpressions>
                        <telerik:GridSortExpression FieldName="SortOrder" SortOrder="Ascending" />
                    </SortExpressions>
                    <Columns>
                        <telerik:GridBoundColumn HeaderText="Label" DataField="Label" UniqueName="Label"/>
                        <telerik:GridBoundColumn HeaderText="Description" DataField="Description"/>
                        <telerik:GridNumericColumn HeaderText="Sort Order" DataField="SortOrder" UniqueName="SortOrder"
                                                    HeaderStyle-Width="100px" />
                        <telerik:GridBoundColumn HeaderText="Last Updated By" DataField="UpdateUser" ReadOnly="true"/>
                        <telerik:GridBoundColumn HeaderText="Last Updated On" DataField="UpdateDate" DataFormatString="{0:MM/dd/yyyy}" ReadOnly="true" />
                        <telerik:GridBoundColumn HeaderText="Created On" DataField="CreateDate" DataFormatString="{0:MM/dd/yyyy}" ReadOnly="true" />
                        <telerik:GridButtonColumn ButtonType="LinkButton" CommandName="Delete" UniqueName="DeleteColumnListing" Text="Delete" ConfirmText="Delete this custom listing?"
                                                    ConfirmDialogType="RadWindow" ConfirmTitle="Delete" HeaderText="Delete" HeaderStyle-Width="50px" />
                    </Columns>
                </MasterTableView>
            </telerik:radgrid>
        </div>
        </form>
    </body>
    </html>

    Here's the code behind.

    using System;
    using System.Collections.Generic;
    using System.Data;
    using System.Data.SqlClient;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using Telerik.Web.UI;
     
    namespace TestWebApp
    {
        public partial class WebForm2 : System.Web.UI.Page
        {
            protected void Page_Load(object sender, EventArgs e)
            {
     
            }
     
            private DataSet GetData()
            {
                DataSet oDS = new DataSet();
     
                // [dbo].[proc_ADMIN_SEL_CustomFieldListing](@ai_i_CustomFieldId int)
                using (SqlConnection oConn = new SqlConnection("Data Source=MDNDEV02;Initial Catalog=Vscript_Trans_DB;User Id=user;Password=pwd;"))
                {
                    using (SqlCommand oCmd = new SqlCommand("proc_ADMIN_SEL_CustomFieldListing", oConn))
                    {
                        oCmd.CommandType = CommandType.StoredProcedure;
                        oCmd.Parameters.AddWithValue("@ai_i_CustomFieldId", 33);
     
                        using (SqlDataAdapter oDA = new SqlDataAdapter(oCmd))
                        {
                            oDA.Fill(oDS);
                        }
                    }
                }
     
                return oDS;
            }
     
            protected void rgListItems_NeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
            {
                RadGrid RadGrid2 = (RadGrid)sender;
                RadGrid2.DataSource = GetData();
            }
        }
    }


    Warren
  5. Warren
    Warren avatar
    24 posts
    Member since:
    May 2008

    Posted 19 Dec 2014 in reply to Warren Link to this post

    I forgot to mention that I'm on UI for ASP.NET AJAX v2014.3.1209 that was released Dec 9, 2014.

    Any help is greatly appreciated.

    Warren
  6. Kostadin
    Admin
    Kostadin avatar
    1709 posts

    Posted 23 Dec 2014 Link to this post

    Hi Warren,

    Note that the TextBox controls that are rendered when you are in edit mode are resized automatically by the browser. A possible solution is to set a 100% width of the TextBox controls. This approach could be achieved by setting hooking PreRender event handler and access the TextBox control from the BatchEditor. Please check out the following code snippet.
    protected void rgListItems_PreRender(object sender, EventArgs e)
    {
        GridTableView masterTable = (sender as RadGrid).MasterTableView;
        GridColumn descriptionColumn = masterTable.GetColumnSafe("Description") as GridColumn;
        TextBox descriptionEditor = (masterTable.GetBatchColumnEditor(descriptionColumn) as GridTextBoxColumnEditor).TextBoxControl;
        descriptionEditor.Width = Unit.Percentage(100);
    }

    Regards,
    Kostadin
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  7. Lee
    Lee avatar
    11 posts
    Member since:
    Jul 2015

    Posted 15 Oct 2015 Link to this post

    Has anyone figured out why this works OK in the demo but not for some people? I too am having this issue
  8. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 15 Oct 2015 Link to this post

    Hello Lee,

    Can you please share your page markup and related code behind so that we can revise them locally and determine what the exact difference between them and the demo code is?

    Regards,
    Maria Ilieva
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  9. Humberto
    Humberto avatar
    1 posts
    Member since:
    Dec 2015

    Posted 10 Dec 2015 in reply to Kostadin Link to this post

    This worked for me but I had to modify it so that it is converted to a radnumerictext box:

     

     Dim masterTable As GridTableView = TryCast(sender, RadGrid).MasterTableView
            Dim descriptionColumn As GridColumn = TryCast(masterTable.GetColumnSafe("CategoryValue"), GridColumn)

            Dim descriptionEditor As RadNumericTextBox = TryCast(masterTable.GetBatchColumnEditor(descriptionColumn), GridNumericColumnEditor).NumericTextBox
            descriptionEditor.Width = Unit.Percentage(100)

Back to Top
UI for ASP.NET Ajax is Ready for VS 2017