Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
231 views
Hi ,

I am using NestedViewTemplate to place a child grid within a parent grid . On click of a column in parent grid the child grid expands . But the columns are not aligned properly . please find the screenshot attached .


Here is my code :

 

 

 

 

<

 

telerik:RadGrid ID="RadGridActions" runat="server" CellSpacing="0" GridLines="None" AutoGenerateColumns="False" AllowSorting="true" Skin="WebBlue"

 

 

OnItemCommand="RadGridActions_ItemCommand" ShowFooter="true" OnItemCreated="RadGridActions_ItemCreated" OnDataBound="RadGridActions_DataBound" >

 

 

<MasterTableView>

 

 

<Columns>

 

 

<telerik:GridTemplateColumn>

 

 

<ItemTemplate>

 

 

<asp:CheckBox ID="chkStat" runat="server" autopostback="true" />

 

 

</ItemTemplate>

 

 

<EditItemTemplate>

 

 

<asp:CheckBox ID="chk" runat="server" AutoPostBack="true" />

 

 

</EditItemTemplate>

 

 

</telerik:GridTemplateColumn>

 

 

 

 

<telerik:GridTemplateColumn visible="false">

 

 

<ItemTemplate>

 

 

<asp:Button ID="BtnExpand" runat="server" Text="+" style="width:20px;height:20px;" CommandName="ExpandOrCollapse" Visible="false" />

 

 

</ItemTemplate>

 

 

</telerik:GridTemplateColumn>

 

 

 

<telerik:GridBoundColumn HeaderText="Set Seq" DataField="ActionSetSequence"></telerik:GridBoundColumn>

 

 

 

<telerik:GridBoundColumn HeaderText="Action Name" DataField="ActionName" ></telerik:GridBoundColumn>

 

 

 

<telerik:GridBoundColumn HeaderText="Predecessor Set Seq." DataField="PredecessorSetSequence" ></telerik:GridBoundColumn>

 

 

 

<telerik:GridBoundColumn HeaderText="Created Dt" DataField="CreateDateTime" ></telerik:GridBoundColumn>

 

 

 

<telerik:GridBoundColumn HeaderText="Last Updated Dt" DataField="EndDateTime" ></telerik:GridBoundColumn>

 

 

 

<telerik:GridBoundColumn HeaderText="Status" UniqueName="Status" DataField="GILStatus" ></telerik:GridBoundColumn>

 

 

 

<telerik:GridBoundColumn UniqueName="RuntimeDt" DataField="NextRunDateTime" Visible="false"></telerik:GridBoundColumn>

 

 

 

<telerik:GridTemplateColumn UniqueName="ImgSchedule" HeaderText="" ></telerik:GridTemplateColumn>

 

 

 

<telerik:GridBoundColumn UniqueName="ActionId" DataField="ActionId" Visible="false" HeaderText="Action Id" ></telerik:GridBoundColumn>

 

 

 

 

</Columns>

 

 

 

 

 

 

<NestedViewSettings DataSourceID="SqlDataSource2" >

 

 

<ParentTableRelation>

 

 

<telerik:GridRelationFields DetailKeyField="ActionID" MasterKeyField="ActionId" />

 

 

</ParentTableRelation>

 

 

</NestedViewSettings>

 

 

 

<NestedViewTemplate>

 

 

 

<telerik:RadGrid ID="RadChildGrid" runat="server" Skin="WebBlue" AutoGenerateColumns="False" OnNeedDataSource="RadChildGrid_Datasource" OnDataBound="RadChildGrid_OnDataBound" OnItemCommand="RadChildGrid_ItemCommand" >

 

 

<MasterTableView>

 

 

<Columns>

 

 

 

<telerik:GridTemplateColumn HeaderText="Replay" UniqueName="Replay">

 

 

<ItemTemplate>

 

 

<asp:ImageButton ID ="ImgBtnReplay" runat="server" ImageUrl="~/Images/replay_disabled.png" CommandName="ReplayAction" CssClass="ReplayImg"/>

 

 

</ItemTemplate>

 

 

</telerik:GridTemplateColumn>

 

 

 

<telerik:GridTemplateColumn>

 

 

<ItemTemplate>

 

 

<asp:LinkButton ID="LBtnServiceName" runat="server" CommandName="Service" Text='<%# Bind("ServiceName")%>' ></asp:LinkButton>

 

 

</ItemTemplate>

 

 

</telerik:GridTemplateColumn>

 

 

 

 

 

<telerik:GridBoundColumn HeaderText="Source Trade Ref" DataField="SourceSystemID" ></telerik:GridBoundColumn>

 

 

 

<telerik:GridBoundColumn HeaderText="GRIP Trade Ref" DataField="GRIPPlacementID" ></telerik:GridBoundColumn>

 

 

 

<telerik:GridBoundColumn HeaderText="Created Dt" DataField="MessageDateTime" ></telerik:GridBoundColumn>

 

 

 

<telerik:GridBoundColumn HeaderText="Last Updated Dt" DataField="StatusDateTime" ></telerik:GridBoundColumn>

 

 

 

<telerik:GridBoundColumn HeaderText="Status" DataField="GILStatus" UniqueName="Status" ></telerik:GridBoundColumn>

 

 

 

<telerik:GridTemplateColumn UniqueName="ImgSchedule" HeaderText="" ></telerik:GridTemplateColumn>

 

 

 

<telerik:GridTemplateColumn UniqueName="ImgSchedule" HeaderText="" ></telerik:GridTemplateColumn>

 

 

 

<telerik:GridBoundColumn UniqueName="RuntimeDt" DataField="NextRunDateTime" Visible="false"></telerik:GridBoundColumn>

 

 

 

<telerik:GridBoundColumn UniqueName="ServiceId" DataField="ServiceID" Visible="false"></telerik:GridBoundColumn>

 

 

 

<telerik:GridTemplateColumn>

 

 

<ItemTemplate>

 

 

<asp:LinkButton ID="LBtnServiceId" runat="server" Text='<%# Bind("ServiceID") %>'></asp:LinkButton>

 

 

</ItemTemplate>

 

 

</telerik:GridTemplateColumn>

 

 

 

 

</Columns>

 

 

 

</MasterTableView>

 

 

 

</telerik:RadGrid>

 

 

</NestedViewTemplate>

 

 

 

</MasterTableView>

 

 

</telerik:RadGrid>

 

Galin
Telerik team
 answered on 20 Jun 2013
1 answer
131 views
I would like to create my rows and columns dynamically and not use Bind... is that possible?
or how do I dynamically create the List object at runtime, as I don't know the number of columns or what they are going to be called.
I do know the list will consist of one string and any number of int columns... basically, I'm needing to do a pivot and account for gaps so I preferably would like to just fill the grid view via code instead of using Bind.
Kostadin
Telerik team
 answered on 20 Jun 2013
14 answers
186 views
How do I hide the Node Expansion symbol if there are no nodes underneath?
Plamen
Telerik team
 answered on 20 Jun 2013
1 answer
76 views
Hello,

Is it possible to copy the content from a RadPanelBarItem on a web page so it could be pasted elsewhere?

Thank You!
Kate
Telerik team
 answered on 20 Jun 2013
8 answers
696 views
I have successfully added a RequiredFieldValidator on my grid, whose EditMode="InPlace":

if ((e.Item is GridDataInsertItem) && e.Item.IsInEditMode)  
{  
    //  Insert is clicked  
    GridEditableItem editedItem = e.Item as GridEditableItem;  
 
    GridDataItem dataItem = (GridDataItem)e.Item;  
 
    GridEditManager editMan = editedItem.EditManager;  
 
    GridDropDownListColumnEditor editor = editMan.GetColumnEditor("Id") as GridDropDownListColumnEditor;  
 
    RadComboBox dropDownList1 = editedItem["Id"].Controls[0] as RadComboBox;  
 
    TableCell cell = (TableCell)editor.ContainerControl;  
    //Declare the validator    
    RequiredFieldValidator rfv = new RequiredFieldValidator();  
 
    rfv.ControlToValidate = dropDownList1.ID;  
    rfv.ID = "valId";  
    rfv.ErrorMessage = @"<img src='Images/cautionIcon.png' class='Validation' />";  
 
    //Add the validator to the cell    
    cell.Controls.Add(rfv);    
 
    editor.ComboBoxControl.Skin = "MySkin";  
    editor.ComboBoxControl.EnableEmbeddedSkins = false;  
    editor.ComboBoxControl.DropDownWidth = Unit.Pixel(500);  
    editor.ComboBoxControl.Width = Unit.Pixel(380);  
 
    var erds = (from result in _s  
             where !_Ds.Any(dto =>  
                 dto.Id == result.SystemID)  
             select result).ToList<DTO>();  
 
    editor.DataSource = s;  
 
    editor.DataBind();  
}  
else if ((e.Item is GridEditableItem) && e.Item.IsInEditMode)  
{  
    //  Edit is clicked  
    GridEditableItem editedItem = e.Item as GridEditableItem;  
 
    GridDataItem dataItem = (GridDataItem)e.Item;  
 
    DTO affected = (DTO)e.Item.DataItem;  
 
    GridEditManager editMan = editedItem.EditManager;  
 
    GridDropDownListColumnEditor editor = editMan.GetColumnEditor("Id") as GridDropDownListColumnEditor;  
 
    RadComboBox dropDownList1 = editedItem["Id"].Controls[0] as RadComboBox;  
 
    TableCell cell = (TableCell)editor.ContainerControl;  
    //Declare the validator    
    RequiredFieldValidator rfv = new RequiredFieldValidator();  
 
    rfv.ControlToValidate = dropDownList1.ID;  
    rfv.ID = "Id";  
    rfv.ErrorMessage = @"<img src='Images/cautionIcon.png' class='Validation' />";  
 
    editor.ComboBoxControl.Skin = "EPSS";  
    editor.ComboBoxControl.EnableEmbeddedSkins = false;  
    editor.ComboBoxControl.DropDownWidth = Unit.Pixel(500);  
    editor.ComboBoxControl.Width = Unit.Pixel(380);  
 
    var erds = (from result in _s  
                where !_as.Any(dto =>  
                    dto.Id == result.SystemID && dto.Id != affected.Id)  
                select result).ToList<DTOSystem>();  
 
    editor.DataSource = s;  
 
    editor.DataBind();  
 
    editor.SelectedValue = affected.Id.ToString();  
 
} 

I know my code is convaluted, but basically its correctly adding a RequiredFieldValidator when you click insert.  But not sure why, its now not putting an identical RequiredfieldValidator when I click 'Edit'?  I would think it would roughly be the same code.

J
Eyup
Telerik team
 answered on 20 Jun 2013
1 answer
80 views
Hi, 
   On a radgrid I would like to create two item command buttons that cause the insert form to create. I need to be able to distinguish between which one was clicked in the itemcreated event though. 

Can I somehow make the radgrid go into insert mode from the itemcommand event? The command names would be InsertChild & InsertAdult.

The reason for this is I want to load a different form into the insert depending on the button clicked. 
David
Top achievements
Rank 1
 answered on 20 Jun 2013
1 answer
76 views
Can someone help with a correct answer to This Thread...  The answer stated does not work..  The issue is that if someone continuously types in the editor the width will expand with the text and there is no setting to prevent this...  Any help would be appreciated. 
Ivaylo
Telerik team
 answered on 20 Jun 2013
6 answers
377 views
Hi all,

I've been experiencing width issues with the RadEditor. More exactly, when I type a continuous single line paragraph the width of the textbox dynamically grows accordingly to the line width.

Find attached screenshots showing the problem.

Thanks in advance.

Code

<telerik:RadEditor ID="txtBody" runat="server" EditModes="Design" Width="98%" Height="200px"
                    ContentAreaMode="Div" NewLineBr="true" ToolbarMode="Default" AutoResizeWidth="false"  >
                    <Tools>
                        <telerik:EditorToolGroup Tag="Edit">
                            <telerik:EditorTool Name="Undo" />
                            <telerik:EditorTool Name="Redo" />
                            <telerik:EditorSeparator />
                            <telerik:EditorTool Name="Cut" />
                            <telerik:EditorTool Name="Copy" />
                            <telerik:EditorTool Name="Paste" ShortCut="CTRL+!" />
                            <telerik:EditorSeparator />
                            <telerik:EditorTool Name="PasteFromWord" />
                            <telerik:EditorTool Name="PasteFromWordNoFontsNoSizes" />
                            <telerik:EditorTool Name="PastePlainText" />
                            <telerik:EditorTool Name="PasteAsHtml" />
                            <telerik:EditorSeparator />
                            <telerik:EditorTool Name="Print" />
                            <telerik:EditorTool Name="SelectAll" />
                            <telerik:EditorSeparator />
                            <telerik:EditorTool Name="InsertDate" />
                            <telerik:EditorTool Name="InsertTime" />
                        </telerik:EditorToolGroup>
                        <telerik:EditorToolGroup Tag="Font">
                            <telerik:EditorTool Name="Bold" />
                            <telerik:EditorTool Name="Italic" />
                            <telerik:EditorTool Name="Underline" />
                            <telerik:EditorTool Name="StrikeThrough" />
                            <telerik:EditorSeparator />
                            <telerik:EditorTool Name="JustifyLeft" />
                            <telerik:EditorTool Name="JustifyCenter" />
                            <telerik:EditorTool Name="JustifyRight" />
                            <telerik:EditorTool Name="JustifyFull" />
                            <telerik:EditorTool Name="JustifyNone" />
                            <telerik:EditorSeparator />
                            <telerik:EditorTool Name="Superscript" />
                            <telerik:EditorTool Name="Subscript" />
                            <telerik:EditorSeparator />
                            <telerik:EditorTool Name="ConvertToLower" />
                            <telerik:EditorTool Name="ConvertToUpper" />
                            <telerik:EditorSeparator />
                            <telerik:EditorTool Name="Indent" />
                            <telerik:EditorTool Name="Outdent" />
                            <telerik:EditorTool Name="InsertOrderedList" />
                            <telerik:EditorTool Name="InsertUnorderedList" />
                            <telerik:EditorTool Name="ToggleTableBorder" />
                        </telerik:EditorToolGroup>
                        <telerik:EditorToolGroup Tag="Color-Font">
                            <telerik:EditorTool Name="ForeColor" />
                            <telerik:EditorTool Name="BackColor" />
                            <telerik:EditorSeparator />
                            <telerik:EditorTool Name="FontName" />
                            <telerik:EditorTool Name="FontSize" />
                        </telerik:EditorToolGroup>
                    </Tools>
                </telerik:RadEditor>


Library Specs
  • Telerik.Web.UI Version=2011.3.1305.35
Ivaylo
Telerik team
 answered on 20 Jun 2013
2 answers
677 views
Good morning everyone. I am trying to use a RadTimePicker to insert a time into a database column with data type of time(7). However, when I try to do this, I get the following error "String was not recognized as a valid TimeSpan." Any ideas?
ihsojsakiv
Top achievements
Rank 2
 answered on 20 Jun 2013
1 answer
117 views
Hi,

            I tried the update query to update the details in grid control with below code.But I got the error(Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
). when i click the update button.

 My Code:
              GridDataItem updateitem = (e.Item as GridDataItem);
            string id = updateitem.OwnerTableView.DataKeyValues[updateitem.ItemIndex]["userid"].ToString();//Error Comes in this line
            TextBox txtuname = (updateitem)["userid"].Controls[0] as TextBox;
            TextBox txtdob = (updateitem)["dateofjoin"].Controls[0] as TextBox;
            TextBox txtpwd = (updateitem)["pwd"].Controls[0] as TextBox;
            string unameupdate = txtuname.Text;
            string dobupdate = txtdob.Text;
            string pwdupdate = txtpwd.Text;
            conn.Open();
            string updateaccount = "update login set userid ='" + unameupdate + "',pwd ='" + pwdupdate + "',cpwd ='" + pwdupdate + "',dateofjoin ='" + dobupdate + "' where userid ='" + id + "'";
            cmd = new MySqlCommand(updateaccount, conn);
            cmd.ExecuteNonQuery();
            conn.Close();
            showaccountuser();
Princy
Top achievements
Rank 2
 answered on 20 Jun 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Dean
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Emil
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Dean
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Emil
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?