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

Edit Template Horizontal Alignment?

2 Answers 210 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Carlos Contreras
Top achievements
Rank 1
Carlos Contreras asked on 08 Jul 2010, 09:46 PM

Hi!

I have a RadGrid with two columns. The first one is a TemplateColumn and the second one a BoundColumn. When I click on the Edit hyperlink/button, a mini form appears below the row that I want to edit with a couple of Textboxes.

My problem is that in the TemplateColumn, I want to use a very short textbox in it's Edit Template, because that field stores only ONE character. BUT that TextBox appears centered, and I would like it on the left side of the Template.

Is there a way to do that?

And yes, I know that being only two fields I could use the InPlace value of the property EditMode, but I'd rather use the EditForms one ;)

Thanks a lot!

2 Answers, 1 is accepted

Sort by
0
Accepted
Dimo
Telerik team
answered on 09 Jul 2010, 09:11 AM
Hello Carlos,

Probably there are some styles on the web page, which are applied to the small edit textbox and as a result, it becomes centered. Please check this with Firebug. Here is a simple page, which works as expected.

<%@ Page Language="C#" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 
<head runat="server">
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<title>RadControls</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" />
 
<telerik:RadGrid
    ID="RadGrid1"
    runat="server"
    Width="800px"
    AutoGenerateColumns="false"
    AutoGenerateEditColumn="true"
    DataSourceID="XmlDataSource1">
    <MasterTableView>
        <Columns>
            <telerik:GridTemplateColumn DataField="ID" HeaderText="ID">
                <ItemTemplate>
                    <%# Eval("ID") %>
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("ID") %>' Width="30px" />
                </EditItemTemplate>
            </telerik:GridTemplateColumn>
            <telerik:GridBoundColumn DataField="Text" HeaderText="Text" />
        </Columns>
    </MasterTableView>
</telerik:RadGrid>
 
<asp:XmlDataSource ID="XmlDataSource1" runat="server">
<Data>
<nodes>
<node ID="1" Text="Text 1" />
<node ID="2" Text="Text 2" />
<node ID="3" Text="Text 3" />
<node ID="4" Text="Text 4" />
</nodes>
</Data>
</asp:XmlDataSource>
 
</form>
</body>
</html>


Kind regards,
Dimo
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
Carlos Contreras
Top achievements
Rank 1
answered on 19 Jul 2010, 07:56 PM
 Indeed Dimo, that was the problem in my case.

 Beisdes your solution, I found that using DIV tags with "style=text-align" before the <EditTemplate> and/or <ItemTemplate> works too!


Thank you very much Dimo!
Tags
Grid
Asked by
Carlos Contreras
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Carlos Contreras
Top achievements
Rank 1
Share this question
or