Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
70 views
Hi
Having a lot of trouble with this one

Setting a Datakey not found error on OrderID property , all I have done is swap out the data source on the ProductsGrid_NeedDataSource method
as below
grid.DataSource = this.GService.GetJobs(GEmployee.id);

Gservice returns two entities as below

var returnedJobs = new List<DemoJobBreakdown>()
{
new DemoJobBreakdown()
{
OrderID = 1,
Job_Subset_ID = 4,
Status = "Complete",
Job_Step = "Installation"
},
new DemoJobBreakdown()
{
OrderID = 2,
Job_Subset_ID = 3,
Status = "Complete",
Job_Step = "Health and Saftey"
}};

and the control is pretty much untouched

​<telerik:RadGrid AllowFilteringByColumn="true" AllowSorting="true" ShowGroupPanel="true"
BackColor="#393939" ID="ProductsGrid" runat="server" AllowPaging="true" PageSize="15"
Width="980px" CssClass="productsGrid" OnPreRender="ProductsGrid_PreRender" OnNeedDataSource="ProductsGrid_NeedDataSource"
Style="outline: 0">
<MasterTableView AutoGenerateColumns="false" PagerStyle-Mode="NextPrevAndNumeric"
ClientDataKeyNames="OrderID" TableLayout="Fixed">
<Columns>
<telerik:GridBoundColumn DataField="OrderID" HeaderText="Order ID" AutoPostBackOnFilter="true"
ShowFilterIcon="false" HeaderStyle-Width="60px" FilterControlWidth="35px">
</telerik:GridBoundColumn>

</Columns>
</MasterTableView>
<ClientSettings AllowDragToGroup="true" EnableRowHoverStyle="true">
<Selecting AllowRowSelect="true" />
<ClientEvents OnRowSelected="RowSelected" />
<Scrolling AllowScroll="true" UseStaticHeaders="true" ScrollHeight="360px" />
</ClientSettings>
</telerik:RadGrid>


Yet it still blows up every time!
Can anyone help?

Thanks
Gerry
Maria Ilieva
Telerik team
 answered on 30 Sep 2014
1 answer
376 views
I have a class defined like below:

ID int
Name varchar(50)
MyBooks List<books>
MyAuthors List<authors>

I am loading in c#  a list of class above.

On the datagrid, I have the main datagrid that will get ID and Name populated when I do the binding.
How can I setup the relationship so the 2 nested grids get the MyBooks as List<books> and MyAuthors as List<authors> bound

thank you
Eyup
Telerik team
 answered on 30 Sep 2014
1 answer
129 views
protected void rtvTopLeftPatientMenu_NodeClick(object o, Telerik.WebControls.RadTreeNodeEventArgs e)
   {
 
       if (e.NodeClicked.Parent != null)
       {
           Session["NodeClicked"] = e.NodeClicked.Parent.Value;
           try
           {
               if (e.NodeClicked.Parent.Parent.Value != null)
               {
                   Session["NodeClicked"] = e.NodeClicked.Parent.Parent.Value;
               }
           }
           catch { };
       }
Hi Guys,

I recently updated telerik controls on a website. Earlier I was using Telerik.WebControls.RadTreeNodeEventArgs but now I'm using Telerik.web.ui.RadTreeNodeEventArgs.

Now my problem is when I change the telerik.webcontrol to telerik.web.ui .............this "e.NodeClicked" property starts showing an error saying that it does not have any property like that. Now I have to update this control but I'm stuck at e.NodeClicked.... So please guys help me out by suggesting some other property which replace this one.
erwerwwerewerererere
 
 protected void rtvTopLeftPatientMenu_NodeClick(object o, Telerik.WebControls.RadTreeNodeEventArgs e)
    {
 
        if (e.NodeClicked.Parent != null)
        {
            Session["NodeClicked"] = e.NodeClicked.Parent.Value;
            try
            {
                if (e.NodeClicked.Parent.Parent.Value != null)
                {
                    Session["NodeClicked"] = e.NodeClicked.Parent.Parent.Value;
                }
            }
            catch { };
        }
 protected void rtvTopLeftPatientMenu_NodeClick(object o, Telerik.WebControls.RadTreeNodeEventArgs e)
    {
 
        if (e.NodeClicked.Parent != null)
        {
            Session["NodeClicked"] = e.NodeClicked.Parent.Value;
            try
            {
                if (e.NodeClicked.Parent.Parent.Value != null)
                {
                    Session["NodeClicked"] = e.NodeClicked.Parent.Parent.Value;
                }
            }
            catch { };
        }
 protected void rtvTopLeftPatientMenu_NodeClick(object o, Telerik.WebControls.RadTreeNodeEventArgs e)
    {
 
        if (e.NodeClicked.Parent != null)
        {
            Session["NodeClicked"] = e.NodeClicked.Parent.Value;
            try
            {
                if (e.NodeClicked.Parent.Parent.Value != null)
                {
                    Session["NodeClicked"] = e.NodeClicked.Parent.Parent.Value;
                }
            }
            catch { };
        }
Hristo Valyavicharski
Telerik team
 answered on 30 Sep 2014
3 answers
167 views

            function PrintPanel() {

            
                var panel = document.getElementById("<%=ResponeData.ClientID %>");
                var printWindow = window.open('', '', 'height=400,width=800');
                printWindow.document.write('<html><head><title>DIV Contents</title>');
                printWindow.document.write('</head><body >');

                printWindow.document.write(panel.innerHTML);
               
                printWindow.document.write('</body></html>');
                printWindow.document.close();
                setTimeout(function () {
                   
                    printWindow.print();
                }, 500);
                return false;
            }  
The above panel "ResponeData" has a rad grid. Im trying to print entire pannel. I want to change back color of the rad grid to "none" while printing. On print screen rad grid color should be none
 





Konstantin Dikov
Telerik team
 answered on 30 Sep 2014
4 answers
482 views
Hi,

I have a rad grid with paging enabled, and i got records displayed in two pages.
Using client script I'm working for selecting/deselecting the rows using checking box and also persisted the check box while paging.
But when I'm trying to read selected rows in rad grid I'm getting only current page records, but not all pages selected records.

Please help me in that regards.

Thanks & Regards
Phaneendra
Eyup
Telerik team
 answered on 30 Sep 2014
9 answers
202 views

I have first two columns of radgrid freezed (as shown in img one).
I have grid with almost 50 columns which contains textboxes, so when i navigate using keyboard tab the freeze columns get hide and also alignment of columns gets disturbed (as shown in img two).
it work fine when i use mouse to navigate.

please help to solve this problem because it severe proble my client is facing.



thanks
Kishor Dange
Konstantin Dikov
Telerik team
 answered on 30 Sep 2014
4 answers
209 views
This question doesn't just apply to the Toolbar but to virtually every other control as well. I looked in the documentation as well as this forum and cannot find the listing of skin names. With the older version of the Rad Controls, Telerik had a demo site that allowed the user to view all the available skins. Why in the world did you leave that out when you updated the newer demo site??
Vargis
Top achievements
Rank 2
 answered on 30 Sep 2014
4 answers
243 views
Hi,

I have a RadGrid with the following definition in ascx control:

<telerik:RadGrid ID="GridCountryBand" runat="server" AutoGenerateColumns="false"
        Skin="Simple" CssClass="caronte-phase-grid"
        AllowPaging="False"
        AllowSorting="false"
        AllowFilteringByColumn="true"
        OnNeedDataSource="GridCountryBand_NeedDataSource"
        OnBatchEditCommand="GridCountryBand_BatchEditCommand"
        OnItemDataBound="GridCountryBand_ItemDataBound"
        >
        <GroupingSettings CaseSensitive="false" />
        <ClientSettings>
            <Scrolling AllowScroll="true" UseStaticHeaders="true" SaveScrollPosition="true" />
            <Selecting AllowRowSelect="true" />
            <ClientEvents OnBatchEditOpening="batchEditOpening" />
        </ClientSettings>
        <MasterTableView HeaderStyle-HorizontalAlign="Center" Width="100%" AutoGenerateColumns="false"
            DataKeyNames="ID_COUNTRY"
            EditMode="Batch">
            <BatchEditingSettings EditType="Cell" OpenEditingEvent="MouseOver" />
            <Columns>
            </Columns>
        </MasterTableView>
 
    </telerik:RadGrid>

Columns are added in Page_Load:

private void AddGridColumns()
        {
            int idTech = Convert.ToInt32(ddlTechnology.SelectedValue);
 
            ITechnologyBandService service = SharePointServiceLocator.GetCurrent().GetInstance<ITechnologyBandService>();
 
            DataSet data = service.GetBandsByTechnology(idTech);
 
            if (data != null && data.Tables.Count > 0)
            {
                GridCountryBand.MasterTableView.Columns.Clear();
 
                GridBoundColumn boundColumn = new GridBoundColumn();
                GridCountryBand.MasterTableView.Columns.Add(boundColumn);
 
                boundColumn.DataField = "DES_COUNTRY";
                boundColumn.HeaderText = "Country";
                boundColumn.ShowFilterIcon = false;
                boundColumn.FilterControlWidth = Unit.Percentage(100);
                boundColumn.AutoPostBackOnFilter = true;
                boundColumn.HeaderStyle.Width = Unit.Pixel(150);
                boundColumn.ItemStyle.Width = Unit.Pixel(150);
 
                foreach (DataRow row in data.Tables[0].Rows)
                {
                    GridCheckBoxColumn checkboxColumn = new GridCheckBoxColumn();
                    GridCountryBand.MasterTableView.Columns.Add(checkboxColumn);
 
                    checkboxColumn.DataField = row["ID_BAND"].ToString();
                    checkboxColumn.HeaderText = row["BAND_NAME"].ToString();
                    checkboxColumn.ShowFilterIcon = false;
                    checkboxColumn.AutoPostBackOnFilter = true;
                    checkboxColumn.ItemStyle.HorizontalAlign = HorizontalAlign.Center;
                    checkboxColumn.HeaderStyle.Width = Unit.Pixel(150);
                    checkboxColumn.ItemStyle.Width = Unit.Pixel(100);
                }
            }

I have an ASP.NET DropDownList in the ascx, outside the RadGrid. When page is loaded DropDownList value cannot be changed (if I set onchange JavaScript event it is not fired) until I try to edit cells (checkboxes).

If I remove batch editing mode, values in DropDownList can be changed with no problem.

Thanks and best regards,

Alfonso
Konstantin Dikov
Telerik team
 answered on 30 Sep 2014
3 answers
303 views

 

 

Please note that I do not have a TemplateColumn in my grid to adding a blank ItemTemplate will not work.  I read the forums until I am tired of doing it.  If I refresh the grid after clearing the IE8 error popup, the record is deleted.  I get the prompt, and the record gets deleted, but I simply must know how to get rid of this stupid message.

I'm guessing it's something with databinding, but I have no idea what.


Please help if possible.  I appreciate the help in advance.

Jason

Datasource...

 

 

 

<asp:LinqDataSource ID="ldsDeviceToDeviceInfo" runat="server"

 

 

 

ContextTypeName="AssetManagementDataContext" EnableDelete="True"

 

 

 

EnableInsert="True" EnableUpdate="True" EntityTypeName=""

 

 

 

OrderBy="DeviceName, ConnType" TableName="Connections">

 

 

 

</asp:LinqDataSource>

I have this in my RadAjaxManager (among other things not related to this grid):

 

 

 

<telerik:AjaxSetting AjaxControlID="grdDevToDev">

 

 

 

<UpdatedControls>

 

 

 

<telerik:AjaxUpdatedControl ControlID="grdDevToDev" LoadingPanelID="RadAjaxLoadingPanel1" />

 

 

 

</UpdatedControls>

 

 

 

</telerik:AjaxSetting>

 

 

 

 

 

 

 

ASPX RadGrid declaration:

               <telerik:RadGrid ID="grdDevToDev" runat="server" EnableLinqExpressions="False" AllowFilteringByColumn="True"
                    AllowPaging="True" AllowSorting="True" CellSpacing="0"
                    DataSourceID="ldsDeviceToDeviceInfo" Font-Names="Verdana" Font-Size="8px" GridLines="None"
                    Skin="WebBlue" Width="90%" AutoGenerateColumns="False" 
                    onitemcommand="grdDevToDev_ItemCommand">
                        <ClientSettings AllowColumnsReorder="True" AllowKeyboardNavigation="true" ReorderColumnsOnClient="True"
                            EnablePostBackOnRowClick="false" >
                            <Selecting AllowRowSelect="True" />
                            <ClientEvents OnPopUpShowing="PopUpShowing" />
                        </ClientSettings>
                        <MasterTableView DataKeyNames="Index"  AllowAutomaticDeletes="true"
                            DataSourceID="ldsDeviceToDeviceInfo" EditMode="Popup" CommandItemDisplay="Top" >
                            <Columns>
                                <telerik:GridEditCommandColumn></telerik:GridEditCommandColumn>
                                <telerik:GridBoundColumn DataField="Index" DataType="System.Int64" 
                                    FilterControlAltText="Filter Index column" HeaderText="Index" 
                                    ReadOnly="True" SortExpression="Index" UniqueName="Index" Visible="false">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="DeviceName" 
                                    FilterControlAltText="Filter DeviceName column" HeaderText="DeviceName" 
                                    SortExpression="DeviceName" UniqueName="DeviceName">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="ConnType" 
                                    FilterControlAltText="Filter ConnType column" HeaderText="ConnType" 
                                    SortExpression="ConnType" UniqueName="ModConnTypeel">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="CableType" 
                                    FilterControlAltText="Filter CableType column" HeaderText="CableType" 
                                    SortExpression="CableType" UniqueName="CableType">
                                    <HeaderStyle Width="150px" />
                                </telerik:GridBoundColumn>
                                <telerik:GridButtonColumn ConfirmText="Delete this record?" ConfirmDialogType="RadWindow"
                                    ConfirmTitle="Delete" ButtonType="LinkButton" CommandName="Delete" Text="Delete"
                                    UniqueName="DeleteColumn">
                                    <HeaderStyle Width="50" />
                                    <ItemStyle HorizontalAlign="Center" />
                                </telerik:GridButtonColumn>
                            </Columns>
  
                            <EditFormSettings InsertCaption="Assign/Modify Device to Device Connection" CaptionFormatString="Edit Record: {0}"
                                CaptionDataField="Index" EditFormType="Template">
                                <PopUpSettings Modal="True" Width="500px" Height="500px" /> 
                                <FormTemplate>
                                    <table id="Table1" cellspacing="0" cellpadding="3" width="450" border="0">
                                        <tr>
                                            <td colspan="3" style="height: 50px">
                                                <asp:ValidationSummary ID="valSummaryNewDevice" ValidationGroup="SaveNewDevice" runat="server"
                                                    ForeColor="DarkRed" Width="670px" />
                                            </td>
                                        </tr>
                                        <tr>
                                            <td colspan="3">
                                                <br />
                                            </td>
                                        </tr>
  
                                        <tr>
                                            <td style="width: 20px;">
                                                   
                                            </td>
                                            <td style="width: 150px; padding: 1px 2px 1px 2px">
                                                <asp:Label ID="Label3" runat="server" CssClass="formLabel" Height="20px" Text="ID"></asp:Label>
                                            </td>
                                            <td>
                                                 <asp:Label ID="tbIndex" Font-Names="Verdana" Font-Size="8pt" runat="server"
                                                    Text='<%# Bind("Index") %>' Width="50px" ></asp:Label>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="width: 20px;">
                                                   
                                            </td>
                                            <td style="width: 150px; padding: 1px 2px 1px 2px">
                                                <asp:Label ID="Label6" runat="server" CssClass="formLabel" Height="20px" Text="Device Name"></asp:Label>
                                            </td>
                                            <td>
                                                <asp:TextBox ID="tbAddDeviceName" Width="200px" Text='<%# Bind("DeviceName") %>' Font-Names="verdana" Font-Size="8pt" runat="server"></asp:TextBox>
                                                <asp:RequiredFieldValidator ID="valNewDeviceSubmit" ControlToValidate="tbAddDeviceName"
                                                    SetFocusOnError="true" ValidationGroup="SaveNewDevice" Display="Dynamic" ErrorMessage="Missing Device Name"
                                                    runat="server">
                                                    <img id="Img5" src="~/images/flag_red.png" runat="server" alt="Missing data" /></asp:RequiredFieldValidator>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="width: 20px;">
                                                   
                                            </td>
                                            <td style="width: 150px; padding: 1px 2px 1px 2px">
                                                <asp:Label ID="Label7" runat="server" CssClass="formLabel" Height="20px" Text="Device Type"></asp:Label>
                                            </td>
                                            <td>
                                               <%-- <telerik:RadComboBox ID="rcbAddDeviceType" runat="server" Font-Names="Verdana" Font-Size="8pt" AllowCustomText="true" 
                                                    MarkFirstMatch="True" NoWrap="True" Skin="Windows7" SortCaseSensitive="False" SelectedValue='<%# Bind("Model") %>'
                                                    MaxHeight="250px" Width="200px" DataSourceID="dsDeviceTypes" DataTextField="Device_Type" DataValueField="Device_Type"
                                                    AutoPostBack="False"  AppendDataBoundItems="true">
                                                    <Items>
                                                        <telerik:RadComboBoxItem Text="" Value="" />
                                                    </Items>
                                                </telerik:RadComboBox>
                                                  
                                                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" ControlToValidate="rcbAddDeviceType"
                                                    SetFocusOnError="true" ValidationGroup="SaveNewDevice" Display="Dynamic" ErrorMessage="Missing Device Type"
                                                    runat="server">
                                                    <img id="Img1" src="~/images/flag_red.png" runat="server" alt="Missing data" /></asp:RequiredFieldValidator>--%>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="width: 20px;">
                                                   
                                            </td>
                                            <td>
                                                <asp:Label ID="Label8" runat="server" CssClass="formLabel" Height="20px" Text="Cabinet"></asp:Label>
                                            </td>
                                            <td>
<%--                                              <telerik:RadComboBox ID="rcbAddDeviceCabinet" runat="server" Font-Names="Verdana" AllowCustomText="true" 
                                                    Font-Size="8pt" MarkFirstMatch="True" NoWrap="True" AutoPostBack="False" Skin="Windows7"
                                                    SortCaseSensitive="False" MaxHeight="250px" Width="200px" DataSourceID="dsCabNums" SelectedValue='<%# Bind("Rack") %>'
                                                    DataTextField="CabinetNumber" DataValueField="CabinetNumber" AppendDataBoundItems="true"  >
                                                    <Items>
                                                        <telerik:RadComboBoxItem Text="" Value="" />
                                                    </Items>
                                                </telerik:RadComboBox>
                                                  
                                                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" ControlToValidate="rcbAddDeviceCabinet"
                                                    SetFocusOnError="true" ValidationGroup="SaveNewDevice" Display="Dynamic" ErrorMessage="Missing Cabinet"
                                                    runat="server">
                                                    <img id="Img3" src="~/images/flag_red.png" runat="server" alt="Missing data" /></asp:RequiredFieldValidator>--%>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="width: 20px;">
                                                   
                                            </td>
                                            <td style="width: 150px; padding: 1px 2px 1px 2px">
                                                <asp:Label ID="Label9" runat="server" CssClass="formLabel" Height="20px" Text="RU Position"></asp:Label>
                                            </td>
                                            <td>
<%--                                                <asp:TextBox ID="tbRUPosition" Text='<%# Bind("Rack_Position") %>' Width="200px" Font-Names="verdana" Font-Size="8pt" runat="server"></asp:TextBox><asp:RequiredFieldValidator
                                                    ID="RequiredFieldValidator3" ControlToValidate="tbRUPosition" SetFocusOnError="true"
                                                    ValidationGroup="SaveNewDevice" Display="Dynamic" ErrorMessage="Missing RU Position"
                                                    runat="server">
                                                    <img id="Img4" src="~/images/flag_red.png" runat="server" alt="Missing data" /></asp:RequiredFieldValidator>--%>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="width: 20px;">
                                                   
                                            </td>
                                            <td colspan="2">
                                                <%--<hr />--%>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td colspan="3">
                                                <br />
                                            </td>
                                        </tr>
                                    </table>
                                    <table style="width: 100%">
                                        <tr>
                                            <td align="center" colspan="2">
                                                <table>
                                                    <tr>
                                                        <td>
                                                            <telerik:RadButton ID="Button1" ValidationGroup="SaveNewDevice" TabIndex="14" CausesValidation="true"
                                                                Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Save" %>' runat="server"
                                                                Skin="WebBlue" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>'>
                                                            </telerik:RadButton>
                                                        </td>
                                                        <td>
                                                            <telerik:RadButton ID="btnCancel" CommandName="Cancel" TabIndex="15" Text="Cancel"
                                                                CausesValidation="False" runat="server" Skin="WebBlue">
                                                            </telerik:RadButton>
                                                        </td>
                                                </table>
                                        </tr>
                                        </td> </tr>
                                    </table>
                                </FormTemplate>
                    <EditColumn UniqueName="EditCommandColumn1">
                    </EditColumn>
                    <FormTableButtonRowStyle HorizontalAlign="Center" />
                </EditFormSettings>
                        </MasterTableView>
                    </telerik:RadGrid>



Only method in code-behind for this grid:
protected void grdDevToDev_ItemCommand(object sender, GridCommandEventArgs e)
{
    AssetManagementDataContext dc = new AssetManagementDataContext();
    if (e.CommandName == RadGrid.DeleteCommandName)
    {
        var index = (int)((GridDataItem)e.Item).GetDataKeyValue("Index");
        //retrieve entity form the Db
        var device = dc.Connections.Where(n => n.Index == index).FirstOrDefault();
        if (device != null)
        {
            //add the category for deletion
            dc.Connections.DeleteOnSubmit(device);
            try
            {
                //submit chanages to Db
                dc.SubmitChanges();
                grdAddSwitch.Rebind();
            }
            catch (System.Exception exc)
            {
                Response.Write("Error deleting switch.\nError Message: " + exc.Message);
            }
        }
    }
}

Kostadin
Telerik team
 answered on 30 Sep 2014
3 answers
173 views
Hi All ,

How to get the column type of a column of radgrid in javascript ?
I need to remove few filter options for 'GridDateTimeColumn'.
So I need to get the column type of the column in 'On Client Showing' event.

Any other way to acheive the same would be appreciated.

Thank you,
Anurag
Konstantin Dikov
Telerik team
 answered on 30 Sep 2014
Narrow your results
Selected tags
Tags
+? more
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?