Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
305 views

I am using a custom class as the DataSource for a radgrid. My class has a structure like this (greatly simplified).

 

public class Batch
{
  public Batch() { }
 
  public int BatchID { get; set; }
  public string FirstName { get; set; }
  public string MiddleName { get; set; }
  public string LastName { get; set; }
  public DateTime BatchDate { get; set; }
  public List<Payment> Payments { get; set; }
}
 
public class Payment
{
  public Payment() { }
 
  public int PaymentID { get; set; }
  public string CheckNumber { get; set; }
  public decimal Amount { get; set; }
}

My grid is defined like this.

<telerik:RadGrid ID="RadGrid1" runat="server">
  <mastertableview datakeynames="BatchID">
    <Columns>
      <telerik:GridBoundColumn DataField="FirstName" HeaderText="First Name" UniqueName="gbcFirstName" />
      <telerik:GridBoundColumn DataField="MiddleName" HeaderText="Middle Name" UniqueName="gbcMiddleName" />
      <telerik:GridBoundColumn DataField="LastName" HeaderText="Last Name" UniqueName="gbcLastName" />
      <telerik:GridBoundColumn DataField="BatchDate" HeaderText="Batch Date" UniqueName="gbcBatchDate" />
    </Columns>
    <DetailTables>
      <telerik:GridTableView runat="server" HierarchyLoadMode="ServerBind" Name="gtvPayments" DataKeyNames="Payments.BatchID">
        <ParentTableRelation>
          <telerik:GridRelationFields MasterKeyField="BatchID" DetailKeyField="Payments.BatchID" />
        </ParentTableRelation>
        <Columns>
          <telerik:GridBoundColumn DataField="Payments.CheckNumber" HeaderText="Check Number" UniqueName="gbcCheckNumber" />
          <telerik:GridNumericColumn DataField="Payments.Amount" HeaderText="Amount" UniqueName="gncAmount" />
        </Columns>
      </telerik:GridTableView>
    </DetailTables>
  </mastertableview>
</telerik:RadGrid>

 

I assign the datasource to the grid in the NeedDataSource event.

void RadGrid1_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
{
  List<Batch> batch = new List<Batch>(1500);
  RadGrid1.DataSource = batch;
}

Since each row in the master table datasource contains a list of its detail items is it possible to create a Master/Detail grid relationship directly from this or do I need to do something in the DetailTableDataBind event?

Thanks

John Mann
Top achievements
Rank 1
 answered on 26 Jan 2017
7 answers
365 views

Hi,

 

I have got the zip file of Telerik_UI_for_ASP.NET_AJAX_2016 zip file from my client, I have extracted this zip file on c://ProgramFiles(x86)/Telerik folder and created one asp.net application in c# visual studio 2015 and added the reference to Telerik.web.dll located in above location but after compiling the application it is giving me an error as "Could not load file or assembly 'Telerik.Web.UI, Version=2016.1.113.45, Culture=neutral, PublicKeyToken=121fae78165ba3d4' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)" .

please let me know can I use Telerik tool kit from zip file? or do I have to install the telerik tool kit on development server ?

Victor
Top achievements
Rank 1
 answered on 26 Jan 2017
3 answers
206 views

I have a Grid with link buttons inside of template fields.  This grid is created after various drop down selections are made.  Once a link button is clicked from inside this "Master" grid, information from that button gets passed to a SQL query to populate a second Grid that is contained within a ModalPopupExtender.  When this grid is databound I would like to resize all the columns to fit the contents.  I have found this on this site: http://www.telerik.com/forums/radgrid-columns-width-fit-the-content-of-the-columns

However, my grid is not bound on pageLoad.  How can I get my "Pop Up" grid to set columns to autowidth when it is bound after the link button click from the "Master" grid?  The Grid is bound to a datatable that is returned from a stored procedure and then the ModalPopupExtender is called with mpe.Show(); .  At present I am setting the width of the grid and all the bound columns to get the desired look.  I have many more grids to populate on this page in similar ModalPopupExtender's.  I would hate to have to set the width's for all grids.

Here is the aspx code for the MPE and RadGrid:

<input id="hidden4" type="hidden" name="hddclick" runat="server" />
<ajaxToolkit:ModalPopupExtender ID="mpIRH" runat="server" PopupControlID="pnlIRH" TargetControlID="hidden4" CancelControlID="lbIRHClose" BackgroundCssClass="modalBackground" />
<asp:Panel ID="pnlIRH" runat="server" CssClass="modalPopup" HorizontalAlign="Center" Style="display: none;">
    <h1 class="bold">Invoice Reg Hours</h1>
    <asp:Panel ID="Panel5" runat="server" CssClass="inputSet">
        <span>Labor Code:</span>
        <asp:Label ID="pnlIRH_lblLC" runat="server" />
    </asp:Panel>
    <asp:Panel ID="Panel6" runat="server" CssClass="inputSet">
        <span>ROM:</span>
        <asp:Label ID="pnlIRH_lblROM" runat="server" />
    </asp:Panel>
    <asp:UpdatePanel ID="pnlIRH_UP" runat="server" UpdateMode="Conditional" AssociatedUpdatePanelID="updateProgress">
        <ContentTemplate>
            <telerik:RadGrid ID="pnlIRH_RadGrid" runat="server" RenderMode="Lightweight" CssClass="box_shadow round-corners AddBorders" AllowPaging="false" AllowSorting="true" CellSpacing="0" GridLines="None" ClientSettings-Scrolling-AllowScroll="true" ClientSettings-Scrolling-UseStaticHeaders="true"
                                ClientSettings-Resizing-AllowColumnResize="true" ClientSettings-AllowColumnsReorder="true" ClientSettings-Animation-AllowColumnReorderAnimation="true" HeaderStyle-HorizontalAlign="Center" HeaderStyle-Font-Size="8pt" MasterTableView-TableLayout="auto" Width="825px"
                                AlternatingItemStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" ClientSettings-ReorderColumnsOnClient="true" ClientSettings-Animation-ColumnReorderAnimationDuration="1" AlternatingItemStyle-Font-Bold="true" ItemStyle-Font-Bold="true" >
                <ClientSettings>
                    <Resizing AllowColumnResize="true" ResizeGridOnColumnResize="true" AllowResizeToFit="true" />
                </ClientSettings>
                <MasterTableView AutoGenerateColumns="false" AllowMultiColumnSorting="true">
                    <Columns>
                        <telerik:GridBoundColumn HeaderText="Payroll" DataField="Payroll" SortExpression="Payroll" ItemStyle-Width="55px" HeaderStyle-Width="55px" />
                        <telerik:GridBoundColumn HeaderText="Employee" DataField="Employee" SortExpression="Employee" />
                        <telerik:GridBoundColumn HeaderText="PLC" DataField="PLC" SortExpression="PLC" ItemStyle-Width="55px" HeaderStyle-Width="55px" />
                        <telerik:GridBoundColumn HeaderText="Week Ending" DataField="Weekending" SortExpression="Weekending" DataFormatString="{0:MM/dd/yyyy}" ItemStyle-Width="55px" HeaderStyle-Width="95px" />
                        <telerik:GridBoundColumn HeaderText="WO Number" DataField="WO Number" SortExpression="WO_Number" ItemStyle-Width="55px" HeaderStyle-Width="130px" />
                        <telerik:GridBoundColumn HeaderText="Fri" DataField="Fri" SortExpression="Fri" ItemStyle-CssClass="width1" HeaderStyle-CssClass="width1" />
                        <telerik:GridBoundColumn HeaderText="Sat" DataField="Sat" SortExpression="Sat" ItemStyle-CssClass="width1" HeaderStyle-CssClass="width1" />
                        <telerik:GridBoundColumn HeaderText="Sun" DataField="Sun" SortExpression="Sun" ItemStyle-CssClass="width1" HeaderStyle-CssClass="width1" />
                        <telerik:GridBoundColumn HeaderText="Mon" DataField="Mon" SortExpression="Mon" ItemStyle-CssClass="width1" HeaderStyle-CssClass="width1" />
                        <telerik:GridBoundColumn HeaderText="Tue" DataField="Tue" SortExpression="Tue" ItemStyle-CssClass="width1" HeaderStyle-CssClass="width1" />
                        <telerik:GridBoundColumn HeaderText="Wed" DataField="Wed" SortExpression="Wed" ItemStyle-CssClass="width1" HeaderStyle-CssClass="width1" />
                        <telerik:GridBoundColumn HeaderText="Thu" DataField="Thu" SortExpression="Thu" ItemStyle-CssClass="width1" HeaderStyle-CssClass="width1" />
                        <telerik:GridBoundColumn HeaderText="Total" DataField="Total" SortExpression="Total" ItemStyle-CssClass="width2" HeaderStyle-CssClass="width2" />
                    </Columns>
                </MasterTableView>
            </telerik:RadGrid>
        </ContentTemplate>
    </asp:UpdatePanel>
    <br />
    <asp:LinkButton ID="lbIRHClose" runat="server" class="button icon fa-info-sign" Style="cursor: pointer;" Text="Close" />
</asp:Panel>

Here is the all the CSS code that is called:

div.RadGrid .rgRow td,
div.RadGrid .rgAltRow td {
    padding: 0px;
}
.modalBackground {
    background-color: Black;
    filter: alpha(opacity=90);
    opacity: 0.8;
}
.modalPopup {
    background-color: #FFFFFF;
    border-width: 3px;
    border-style: solid;
    border-color: black;
    padding: 10px;
    width: auto;
    height: auto;
    max-width: 90%;
}
.width1 {
    width: 35px;
}
.width2 {
    width: 50px;
}
/* Add vertical lines to RadGrid */
div.AddBorders .rgHeader:first-child,
div.AddBorders th.rgResizeCol:first-child,
div.AddBorders .rgFilterRow td:first-child,
div.AddBorders .rgRow td:first-child,
div.AddBorders .rgAltRow td:first-child,
div.AddBorders .rgEditRow td:first-child,
div.AddBorders .rgFooter td:first-child
{
    border-left-width:0;
}
div.AddBorders .rgHeader,
div.AddBorders th.rgResizeCol,
div.AddBorders .rgFilterRow td,
div.AddBorders .rgRow td,
div.AddBorders .rgAltRow td,
div.AddBorders .rgEditRow td,
div.AddBorders .rgFooter td
{
    border-style:solid;
    border-color:#aaa;
    border-width:0 0 1px 1px; /*top right bottom left*/
}
Viktor Tachev
Telerik team
 answered on 26 Jan 2017
1 answer
64 views

I have a column chart with two series.

One is very important and the other is more just added information.

I would like to make column 2 with the extra information smaller in width than series 1.

This is so its visually obvious this is the main data.

How do you do this? If its not possible, do you have any suggestions?

Thanks,

Stamo Gochev
Telerik team
 answered on 26 Jan 2017
4 answers
447 views
Hi Telerik Team,

We are using rad chart for drawing Bar and Line Series graphs.
When the Y axis value is 1 or 2 the Y axis shows decimal points. Need to eliminate the decimal points. Please refer the screen shot.
At any point of time my Y axis should not contain the decimal, as our result data will not have such decimal data.

Thanks and regards.
Al
Top achievements
Rank 1
Iron
Iron
Iron
 answered on 26 Jan 2017
2 answers
339 views

RadAsyncUpload control works great when in debug mode. 

When i deploy the same on my server, the documents always have the red dot next to the document.

They are not saved to the database.

Am i missing  any property/setting here?

Thanks in Advance.

 

Ivan Danchev
Telerik team
 answered on 26 Jan 2017
2 answers
201 views

Hi, I have a RadListBox that is being populated on Page_Load through a DataTable that comes from the DB. Problem is: when I try to iterate the ItemCollection (via the Items Property) the List has Count=1 (the first item), when it was supposed to be 20+(I don't know the exact item count). Below are the relevant snippets:

Here the list is iterated to find out what items are selected in the db and move them from this list to another.

protected void ListaPaisExp_ItemDataBound(object sender, RadListBoxItemEventArgs e)
        {
            foreach (DataRow dr in Empresa.Tables[1].Rows)
            {
                foreach (RadListBoxItem item in ListaPaisExp.Items)
                {
                    if (item.Value == dr["tipopaisid"].ToString())
                    {
                        ListaPaisExpSel.Items.Add(item);
                        item.Remove();
                    }
                }
            }
        }

 

And this is the DataBind on Page_Load:

ListaPaisExp.DataSource = Tipos_DAL.GetTiposByArchtype("pais");
ListaPaisExp.DataValueField = "ID";
ListaPaisExp.DataTextField = "Descricao";
ListaPaisExp.DataBind();
Pedro
Top achievements
Rank 1
 answered on 26 Jan 2017
1 answer
41 views

it is possible get table html from radgrid side client.

Example

var grid = $find("<%=GrdCobros.ClientID %>");

var table = grid.innerHtml  //get <table><tr><td>...

Milena
Telerik team
 answered on 26 Jan 2017
1 answer
113 views

Hello dear telerik-team,

we are facing a huge problem with your example from here: http://demos.telerik.com/aspnet-ajax/dropdowntree/examples/populatingwithdata/webserviceandclienttemplates/defaultcs.aspx  , because we have like ~18000 Categories which we have to fill.

 

The problem we are now facing is, that we have created the exact copy of you webservice, but it isn't working like on your site.

We are using "Postman"-Extension for chrome and when we post something like 

"{"node":{"Text":"Politics","Value":"2","Key":null,"ExpandMode":3,"NavigateUrl":null,"PostBack":true,"DisabledCssClass":null,"SelectedCssClass":null,"HoveredCssClass":null,"ImageUrl":null,"HoveredImageUrl":null,"DisabledImageUrl":null,"ExpandedImageUrl":null,"ContextMenuID":"","Checked":false},"context":[]}"

on your demo-Url : http://demos.telerik.com/aspnet-ajax/dropdowntree/examples/populatingwithdata/webserviceandclienttemplates/DropDownTreeWebService.svc/LoadData

We are getting a nice json which looks like this:{
  "d": [
    {
      "__type": "DropDownNodeData:#Telerik.Web.UI",
      "Attributes": [],
      "ExpandMode": 0,
      "Text": "CNN",
      "Value": "5"
    }, ........

But when we are doing the same thing to our webservice we get :

[
  {
    "Attributes": [],
    "ExpandMode": 0,
    "Text": "Sammeln & Seltenes",
    "Value": "1"
  }, ....

So we are wondering if you could tell us, which settings for the service you have done in the web.config file.

 

 

 

Chris
Top achievements
Rank 1
 answered on 26 Jan 2017
4 answers
147 views

Dear all,

I use Radgrid with popup window. I want to implement specific scenario. My item has relations to different tables and I can add/modify them only when item is created (otherwise I don't have primary key). My idea is: when I insert new item I want to save it and automatically open the same item in edit mode. It means user can continue to create additional relations and it is not necessary to find new item in grid and start edit mode.

Can you help me if it is possible and how to implement it?

Thank you,

Petr

Petr
Top achievements
Rank 1
Iron
Iron
 answered on 26 Jan 2017
Narrow your results
Selected tags
Tags
+? more
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?