We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

ItemTemplate align

Hello,

how i can align an item in an template column? I have the same problem in a related child table. I have a chechbox and i want toput it in the center of the column.

Thanks
Fabio

2 Replies

FA Fabio June 15, 2012 07:42 AM UTC

I have also an another problem. I put a NumericTextBox (or a CurrencyTextBox) as EditItemTemplate in a child table, but when i go in add new record mode the new row put the textbox not in the middle of  cell but at the bottom. The problem is that an   is rendered in cell rendering and this put the numerictextbox in a wrong position. This is the HTML of TD that was rendered by grid control:

<td valign="middle" class=" GridOffice2007BlueSelectedUfRowCells" id="MainContent" style=""> <div id="MainContent_hack_2" style="-moz-box-sizing: border-box;">
                        <input type="hidden" id="MainContent_txtMinuti_2_hidden" name="MainContent_txtMinuti_2_hidden"><div style="width: 60px; display: block; height: 22px;" dir="ltr" id="MainContent_txtMinuti_2">
                            <table cellspacing="0" cellpadding="0" style="width:60px;background-color:White;">
                                <tbody><tr>
                                    <td align="right" style="width:100%;padding:0px;border-left:1px solid #808080;border-top:1px solid #808080;border-bottom:1px solid #FFFFFF;border-right:1px solid #FFFFFF;"><div style="border-left: 1px solid rgb(64, 64, 64); border-width: 1px; border-style: solid; border-color: rgb(64, 64, 64) rgb(212, 208, 200) rgb(212, 208, 200) rgb(64, 64, 64); height: 19px;"><input type="text" style="text-align: right; width: 58px; border: 0px none; padding: 0px; margin: 0px; height: 21px;" title="Range of values: from 0 to 1,79769313486232E+308" id="MainContent_txtMinuti_2_text_2" value="0" name="ctl00$MainContent$GridGroupingControl1EditCell51$txtMinuti$text"></div></td>
                                </tr>
                            </tbody></table>

                        </div>
                    </div></td>


With Dropdownlist i haven't any problem it's all ok. I add the control dynamically at run time in the child grid.

How i can fix it?
Thanks in advice,
Fabio
Thanks




spaceImage_27858c2.rar


SN Sridhar N Syncfusion Team June 18, 2012 07:33 AM UTC

Hi Fabio,

Thanks for your interest in Syncfusion products.

Your requirement to align the element can be achieved by setting the properties VerticalAlignment, HorizontalAlignment. Please refer the below code snippet.

 

[Codebehind – C#]

GridRelationDescriptor childrelationdescriptor = new GridRelationDescriptor();

childrelationdescriptor.ChildTableName = "Product";

childrelationdescriptor.RelationKind = RelationKind.RelatedMasterDetails;

childrelationdescriptor.RelationKeys.Add("Category ID", "Category ID");

childrelationdescriptor.ChildTableDescriptor.AllowNew = true;

GridGroupingControl1.TableDescriptor.Relations.Add(childrelationdescriptor);

this.GridGroupingControl1.Engine.SourceListSet.Add("Category", GetParent);

this.GridGroupingControl1.Engine.SourceListSet.Add("Product", GetDetail);

childrelationdescriptor.ChildTableDescriptor.Columns.FindByMappingName("Check").Appearance.AnyRecordFieldCell.VerticalAlignment = GridVerticalAlignment.Middle;

childrelationdescriptor.ChildTableDescriptor.Columns.FindByMappingName("Check").Appearance.AnyRecordFieldCell.HorizontalAlignment = GridHorizontalAlignment.Center;

this.GridGroupingControl1.DataMember = "DefaultView";

this.GridGroupingControl1.DataSource = GetParent;

this.GridGroupingControl1.TableDescriptor.Name = "Category";

 

For your convenience, we have created sample and the same can be downloaded from the following link.

 

http://www.syncfusion.com/downloads/Support/DirectTrac/95502/2%20level%20hierarchy-1168793817.zip

Please let me know if you have any other questions or concerns.

 

Regards,

Sridhar.N

 

 


Loader.
Live Chat Icon For mobile
Up arrow icon