?
Solved

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

Posted on 2013-06-25
5
Medium Priority
?
574 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 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

Learn by Doing. Anytime. Anywhere.

Do you like to learn by doing?
Our labs and exercises give you the chance to do just that: Learn by performing actions on real environments.

Hands-on, scenario-based labs give you experience on real environments provided by us so you don't have to worry about breaking anything.

Question has a verified solution.

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

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
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!
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
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…
Suggested Courses

762 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