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

[Solved] Probem with texbox width in edit mode and server callback

4 Answers 117 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Ju
Top achievements
Rank 1
Ju asked on 23 May 2011, 08:24 AM
Hello,

I'm new with telerik grid in ASP.Net MVC3.
I'm trying to do a simple grid with edit mode in line.

I used poco to display my data.
When i'm in display mode, everything is ok in my grid. But when i'm calling the edit mode, nothing is aligned anymore. Textbox are too large for columns (see the attach file)

Here is my code
@model List<ProtoFTCarto.Models.FormateurDto>
           
@{
   ViewBag.Title = "Index";
}
<br />
<div class="blockTitle">
   Formateurs (Grille simple via ajax)</div>
<div style="display: block;" class="blockContent">
@(Html.Telerik().Grid(Model)
.Name("Grid")
   .TableHtmlAttributes(new { style = "table-layout:fixed" })
.DataKeys(keys => keys.Add(c => c.Identifiant))
   .ToolBar(commands => commands.Insert().ButtonType(GridButtonType.BareImage).ImageHtmlAttributes(new { style = "margin-left:0" }))
   .DataBinding(dataBinding =>
   {
      dataBinding.Ajax()
         .Select("_Index", "SLA2")
         .Insert("_Insert", "SLA2")
         .Update("_Update", "SLA2")
         .Delete("_Delete", "SLA2");
   })
.Columns(columns =>
{
   columns.Command(commands =>
   {
      commands.Edit().ButtonType(GridButtonType.BareImage);
      commands.Delete().ButtonType(GridButtonType.BareImage);
   }).Width(30).Title("Commands");
columns.Bound(p => p.Nom).Width(210);
columns.Bound(p => p.Prenom).Width(130);
;
 
})
   .Editable(editing => editing.Mode(GridEditMode.InLine))
   )
</div>

Thanks for your help.

Ju (from France)

4 Answers, 1 is accepted

Sort by
0
Demon
Top achievements
Rank 1
answered on 23 May 2011, 08:59 AM
Hi,

You should check what styles makes those textboxes too wide. Compare your implementation with a similar demo on Telerik's website:

http://demos.telerik.com/aspnet-mvc/grid/editingajax
0
Ju
Top achievements
Rank 1
answered on 23 May 2011, 09:32 AM
The class of the textbox is "text-box single-line" in both example.
I can't find the css class in the example. I've seracgh for text-box and only find : font-size:100%;

It's the same in my solution. I tried to put back the original css file but the table content does always the same.

What is strange is that in ajax mode it works fine. Also if i connect the database without using a intermediate object class, it works fine also. I don't understand what's going on.

Do you have any other ideas ?

I'm not sure it's only the texbox. The width of the first column is also modified.
0
Accepted
Atanas Korchev
Telerik team
answered on 23 May 2011, 10:02 AM
Hi,

 The problem is that you have set the width of all columns. However the total width of the grid is higher that the sum of all column widths. You need to leave one of the columns without set width so it can take the rest of the table width:

.Columns(columns =>
{
   columns.Command(commands =>
   {
      commands.Edit().ButtonType(GridButtonType.BareImage);
      commands.Delete().ButtonType(GridButtonType.BareImage);
   }).Width(30).Title("Commands");
columns.Bound(p => p.Nom);
columns.Bound(p => p.Prenom).Width(130);
;
  
})

Greetings,
Atanas Korchev
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
0
Ju
Top achievements
Rank 1
answered on 23 May 2011, 10:09 AM
Thanks for your help. It works fine now.
Tags
Grid
Asked by
Ju
Top achievements
Rank 1
Answers by
Demon
Top achievements
Rank 1
Ju
Top achievements
Rank 1
Atanas Korchev
Telerik team
Share this question
or