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

Batch Edit TxtBox width

7 Answers 277 Views
Grid
This is a migrated thread and some comments may be shown as answers.
vadim
Top achievements
Rank 1
vadim asked on 03 Nov 2014, 01:24 AM
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

7 Answers, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 05 Nov 2014, 01:55 PM
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.

 
0
Warren
Top achievements
Rank 2
answered on 18 Dec 2014, 10:31 PM
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
0
Warren
Top achievements
Rank 2
answered on 19 Dec 2014, 02:13 PM
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
0
Kostadin
Telerik team
answered on 23 Dec 2014, 11:14 AM
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.

 
0
Lee
Top achievements
Rank 1
answered on 15 Oct 2015, 08:48 AM
Has anyone figured out why this works OK in the demo but not for some people? I too am having this issue
0
Maria Ilieva
Telerik team
answered on 15 Oct 2015, 11:18 AM
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
0
Humberto
Top achievements
Rank 1
answered on 10 Dec 2015, 06:03 PM

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)

Tags
Grid
Asked by
vadim
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
Warren
Top achievements
Rank 2
Kostadin
Telerik team
Lee
Top achievements
Rank 1
Humberto
Top achievements
Rank 1
Share this question
or