?
Solved

Applying the same width to all textboxes in edit mode (telerik radgrid)

Posted on 2013-06-25
5
Medium Priority
?
577 Views
Last Modified: 2013-09-02
Hello!

When I enter edit mode in a Telerik radgrid I end up with all the textboxes beeing in different width.

I thought of solving this, by looping through all the items that is beeing edited and set them to System.Web.UI.WebControls.Unit.Pixel(300); to change the size.

I have tried with a loop looking something like below, but obviously this will yield error,

Any idea what to do to make them into the same size?

foreach (GridEditFormItem EdItem in rgRelMaterial.Columns)
  {
        EdItem.Width = System.Web.UI.WebControls.Unit.Pixel(300);
  }
0
Comment
Question by:clooak
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 41

Expert Comment

by:Kyle Abrahams
ID: 39274771
foreach (Telerik.Web.UI.GridColumn c in rgRelMaterial.MasterTableView.RenderColumns)
            {
                c.HeaderStyle.Width = Unit.Pixel(300);
            }
0
 

Author Comment

by:clooak
ID: 39274831
I thought of that as first aswell, but the problem is that Telerik differs the textbox in the grid and the edit items.

When I use the code you gave, it will only change the textboxes in normal view (before and after edit) not the textboxes in edit mode.

So I need to determine somehow if the textbox found is in editmode or not, so that I don't alter the normal textboxes.

Tricky  I know :(
0
 

Accepted Solution

by:
clooak earned 0 total points
ID: 39274860
I think I sorted it out, by using onColumnCreated event (since the edit textboxes are created on the fly)

Something like this should work

protected void rgRelMaterialLoad_ColumnCreated(object sender, Telerik.Web.UI.GridColumnCreatedEventArgs e)
        {

 if (e.Item is GridEditableItem && e.Item.IsInEditMode)
    {   
         // Insert code here to edit the width of the Column added.
    }
}

Open in new window

0
 
LVL 41

Expert Comment

by:Kyle Abrahams
ID: 39275718
Test it and if it is feel free to accept your own answer as the solution :-).  Good knowledge for anyone else coming through.
0
 

Author Closing Comment

by:clooak
ID: 39457789
Solved it myself
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question