Solved

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

Posted on 2013-06-25
5
554 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
  • 3
  • 2
5 Comments
 
LVL 40

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 40

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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

864 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now