Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
211 views

My company just purchased the Telerik Premium Collection for .NET and asked me to start making some charts that are due in a few days. I have no experience with Telerik or reporting in general so I need as much help as I can get.

I have a database table that represents each developer’s time scheduled by project managers. It has the following fields:
Employee, Date, Hours, Project Code

My manager wants a stacked bar chart that has the date on the X axis and hours on the Y axis. Each bar would show the number of hours scheduled that day grouped by project code. He wants the chart to show one employee at a time with the ability to switch to different employees. The dates on the X axis would show the current week with the ability to scroll to the right to see future dates scheduled, up to 3 months. Also, he wants you to be able to hover over the bar chart to see the project code related to those hours.

Velin
Telerik team
 answered on 18 May 2009
1 answer
129 views
Hi,
I want to create a RADGrid with a Hierarchical view, from server side. i.e
i want to bind the Grid with my dataset, and form a relation with the GridTableView on some column.
since my queries are based on paramters.
The below is my code, pls tell me wht is the error in it,
i am able to bind data to MainGrid but the Hierarchical grid is not forming a realtion with main grid.

 

using

 

System;

 

using

 

Telerik.Web.UI;

 

using

 

System.Web.UI.WebControls;

 

 

using

 

System.Data;

 

using

 

System.Data.SqlClient;

 

using

 

System.Configuration;

 

using

 

System.Collections;

 

using

 

System.Web;

 

using

 

System.Web.Security;

 

using

 

System.Web.UI;

 

using

 

System.Web.UI.WebControls.WebParts;

 

using

 

System.Web.UI.HtmlControls;

 

namespace

 

Telerik.GridExamplesCSharp.Programming.Hierarchy

 

{

 

public partial class OneView : System.Web.UI.Page

 

{

 

private void DefineGridStructure()

 

{

 

 

RadGrid RadGrid1 = new RadGrid();

 

RadGrid1.ID =

"RadGrid1";

 

 

 

//RadGrid1.DataSourceID = "SqlDataSource1";

 

RadGrid1.AutoGenerateColumns =

false;

 

RadGrid1.Skin =

"Web20";

 

RadGrid1.MasterTableView.DataKeyNames =

new string[] { "CustomerID" };

 

RadGrid1.Width =

Unit.Percentage(98);

 

RadGrid1.PageSize = 3;

RadGrid1.AllowPaging =

true;

 

RadGrid1.AllowSorting =

true;

 

RadGrid1.PagerStyle.Mode =

GridPagerMode.NextPrevAndNumeric;

 

RadGrid1.AutoGenerateColumns =

false;

 

RadGrid1.ShowStatusBar =

true;

 

RadGrid1.MasterTableView.PageSize = 3;

 

//Add columns

 

 

GridBoundColumn boundColumn;

 

boundColumn =

new GridBoundColumn();

 

boundColumn.DataField =

"CustomerID";

 

boundColumn.HeaderText =

"CustomerID";

 

RadGrid1.MasterTableView.Columns.Add(boundColumn);

boundColumn =

new GridBoundColumn();

 

boundColumn.DataField =

"ContactName";

 

boundColumn.HeaderText =

"Contact Name";

 

RadGrid1.MasterTableView.Columns.Add(boundColumn);

RadGrid1.DataSource = MakeDS().Tables[0];

RadGrid1.DataBind();

 

 

 

            //Detail table - Orders (II in hierarchy level)

 

 

GridTableView tableViewOrders = new GridTableView(RadGrid1);

 

tableViewOrders.AutoGenerateColumns =

false;

 

 

//tableViewOrders.DataSourceID = "SqlDataSource2";

 

tableViewOrders.da

 

 

////Add columns

 

boundColumn =

new GridBoundColumn();

 

boundColumn.DataField =

"OrderID";

 

boundColumn.HeaderText =

"OrderID";

 

tableViewOrders.Columns.Add(boundColumn);

boundColumn =

new GridBoundColumn();

 

boundColumn.DataField =

"OrderDate";

 

boundColumn.HeaderText =

"Date Ordered";

 

tableViewOrders.Columns.Add(boundColumn);

tableViewOrders.DataSource = MakeDS().Tables[1];

tableViewOrders.DataBind();

tableViewOrders.Width =

Unit.Percentage(100);

 

tableViewOrders.DataKeyNames =

new string[] { "OrderID" };

 

 

 

GridRelationFields relationFields = new GridRelationFields();

 

relationFields.MasterKeyField =

"CustomerID";

 

relationFields.DetailKeyField =

"CustomerID";

 

tableViewOrders.ParentTableRelation.Add(relationFields);

RadGrid1.MasterTableView.DetailTables.Add(tableViewOrders);

 

//Add the RadGrid instance to the controls

 

 

this.PlaceHolder1.Controls.Add( RadGrid1 );

 

}

 

 

protected void Page_Init(object source, System.EventArgs e)

 

{

DefineGridStructure();

}

 

protected void Page_Load(object sender, EventArgs e)

 

{

 

RadGrid Grid1 = (RadGrid)PlaceHolder1.FindControl("RadGrid1");

 

 

 

 

}

 

public DataSet MakeDS()

 

{

 

SqlDataAdapter DA = new SqlDataAdapter();

 

 

DataSet DS = new DataSet();

 

 

SqlCommand cmd;

 

 

string strconnection =

 

 

@"Data Source=MY\SQLEXPRESS;Initial Catalog=Northwind;Integrated Security=True";

 

 

SqlConnection sqlcon = new SqlConnection();

 

sqlcon.ConnectionString = strconnection;

cmd =

new SqlCommand("SELECT * FROM Customers", sqlcon);

 

cmd.Connection.Open();

 

DA.SelectCommand = cmd;

 

//creating datasets

 

 

DA.Fill(DS,

"MainTable");

 

 

cmd =

new SqlCommand("SELECT * FROM Orders ", sqlcon);

 

DA.SelectCommand = cmd;

DA.Fill(DS,

"SecondTable");

 

cmd.Connection.Close();

 

return DS;

 

}

}

}


Pls help me out!
Thanks for your help in advance.

Sebastian
Telerik team
 answered on 18 May 2009
1 answer
114 views
Hi,

I have a menu inside a WebUserControl. The problem is that the Radmenuitems do not open. That it they do not overlay the WebUserControl boundary.

In fact the menu is inside a WebUserControl that is inside a Panel. Like this:

<

 

asp:Panel id="pnlMenu" width="100%" runat="server" CssClass="collapsePanel">

 

 

<ak:MainMenu width="100%" height="100%" id="AppMainMenu" Runat="Server" />

 

 

</asp:Panel>

 


I thought that the problem was the UserControl then I put the menu directly inside the outer panel (pnlMenu) and it did not worked too.

When I put the same menu directly in the main window it works OK.

Can you help me ???

Thanks
Paul
Telerik team
 answered on 18 May 2009
3 answers
133 views
Hi

I am having a RadWindow (say it's opened as http://yahoo.com), on click of reload button at top of radwindow I want to open a new rad window, with another link say (http://www.google.com).

Is it possible. Replies will be apprecoated

Thanks in Advance

Arindam
Arindam
Top achievements
Rank 1
 answered on 18 May 2009
2 answers
121 views
Hi,
I am completely new to telerik... We are about to buy but I am having some troubles to get started ..
I try to bind the treeview to the following structure:

- Assessment
  - Folder
    - Folder
    ....
- Assessment

(assessment is an own domain object and folder too)

I am getting all assessment as a list<Assessment> and those can contain 0-n folders. I tried to bind the treeview to the assessments and call the assessments Folders property within NodeDataBound.

Thats the page_load:

protected void Page_Load(object sender, EventArgs e) { 
        if (!IsPostBack) { 
            RadTreeView1.DataSource = new NHibernateDaoFactory().GetTagGroupDao().GetAll(); 
            RadTreeView1.DataBind(); 
            RadTreeNode untaggedNode = new RadTreeNode(GetLocalResourceObject("res_untagged").ToString(), ""); 
            untaggedNode.AllowDrag = true; 
            untaggedNode.Checkable = true; 
            RadTreeView1.Nodes.Add(untaggedNode); 
 
            uxTreeAssessments.DataSource = new NHibernateDaoFactory().GetAssessmentDao().GetAll(); 
            uxTreeAssessments.DataFieldID = "ID"; 
            uxTreeAssessments.DataValueField = "ID"; 
            uxTreeAssessments.DataTextField = "LocalizedName"; 
            uxTreeAssessments.DataBind(); 
        } 
    } 

And then the nodedatabound:

protected void uxTreeAssessments_NodeDataBound(object sender, Telerik.Web.UI.RadTreeNodeEventArgs e) { 
        if (e.Node.Level == 0) { 
            Assessment a = e.Node.DataItem as Assessment; 
            foreach (Folder f in a.Folders) { 
                RadTreeNode n = new RadTreeNode( 
                    string.Format("{0} ({1})", f.LocalizedName, f.Questions.Count), 
                    f.ID.ToString()); 
                n.DataItem = f; 
                e.Node.Nodes.Add(n); 
            } 
        } else if (e.Node.Level > 0) { 
            Folder parent = e.Node.DataItem as Folder; 
            foreach (Folder f in parent.Folders) { 
                RadTreeNode n = new RadTreeNode( 
                    string.Format("{0} ({1})", f.LocalizedName, f.Questions.Count), 
                    f.ID.ToString()); 
                n.DataItem = f; 
                e.Node.Nodes.Add(n); 
            } 
        } 
    } 

The problem is that the ELSE IF part is never called ... and thus the sub folders of the folders are not rendered.

Any assistance would be appreciated as I am stuck here.. Not even sure if the approach is correct.
Thanks!!
Atanas Korchev
Telerik team
 answered on 18 May 2009
4 answers
209 views
Hi

I have a grid with self hierarchy. I am creating the grid and columns programatically in the Page_Init event handler (method createGrid()). I set the AutoGenerateEditColumn property to 'true'. When creating the columns, i created a GridTemplateColumn using my own custom template- 'MyTemplate' and edit template- 'MyEditTemplate'. MyTemplate contains only a Label and MyEditTemplate contains a TextBox (both asp controls). The grid is rendered perfectly but when i click the "edit" link button I'm getting a postBack (no ajax behaviour) and the item is not opened for editing...

i attached some of my code - createGrid() method and the item templates

Why doesn't the edit command work?..

private void createGrid()  
    {  
 
 
        grdRuns.ID = "grdRuns";  
 
        grdRuns.ColumnCreated -= new GridColumnCreatedEventHandler(grdRuns_ColumnCreated);  
        grdRuns.ItemCreated -= new GridItemEventHandler(grdRuns_ItemCreated);  
        grdRuns.ItemDataBound -= new GridItemEventHandler(grdRuns_ItemDataBound);  
 
        grdRuns.AutoGenerateColumns = false;  
        grdRuns.HorizontalAlign = HorizontalAlign.Right;  
        grdRuns.MasterTableView.HorizontalAlign = HorizontalAlign.Right;  
        grdRuns.MasterTableView.Dir = GridTableTextDirection.RTL;  
        grdRuns.EnableEmbeddedSkins = false;  
        grdRuns.Skin = "Portal";  
        grdRuns.ClientSettings.Scrolling.UseStaticHeaders = true;  
        grdRuns.ClientSettings.Scrolling.AllowScroll = true;  
        grdRuns.MasterTableView.HierarchyDefaultExpanded = true;  
        grdRuns.MasterTableView.TableLayout = GridTableLayout.Fixed;  
        grdRuns.AutoGenerateEditColumn = true;  
        grdRuns.AllowAutomaticUpdates = true;  
 
        grdRuns.MasterTableView.EditMode = GridEditMode.EditForms;  
                  
        grdRuns.ColumnCreated += new GridColumnCreatedEventHandler(grdRuns_ColumnCreated);  
        grdRuns.ItemCreated += new GridItemEventHandler(grdRuns_ItemCreated);  
        grdRuns.ItemDataBound += new GridItemEventHandler(grdRuns_ItemDataBound);  
          
 
        NostroDataSet.FieldsForGridDataTable dtFields = BLManager.GetFieldsForGrid(int.Parse(ddlRuns.SelectedValue));  
 
        foreach (NostroDataSet.FieldsForGridRow row in dtFields.Rows)  
        {  
 
            if (row.IsEditable)  
            {  
                GridTemplateColumn templateColumn = new GridTemplateColumn();  
                string templateColumnName = row.FieldName;  
 
                templateColumn.ItemTemplate = new MyTemplate(templateColumnName);  
                templateColumn.EditItemTemplate = new MyEditTemplate(templateColumnName);  
                templateColumn.HeaderText = row.ScreenName;  
                templateColumn.Display = row.Display;  
                templateColumn.HeaderStyle.Width = Unit.Pixel(row.Witdh);  
                templateColumn.ItemStyle.Width = Unit.Pixel(row.Witdh);  
                  
                grdRuns.MasterTableView.Columns.Add(templateColumn);  
                  
            }  
 
            else 
            {  
                GridBoundColumn clm = new GridBoundColumn();  
                clm.DataField = row.FieldName;  
                clm.HeaderText = row.ScreenName;  
                clm.UniqueName = row.FieldName;  
 
                clm.HeaderStyle.Wrap = false;  
                clm.ItemStyle.Wrap = false;  
 
                clm.HeaderStyle.Width = Unit.Pixel(row.Witdh);  
                clm.ItemStyle.Width = Unit.Pixel(row.Witdh);  
 
                grdRuns.MasterTableView.Columns.Add(clm);  
 
                clm.Display = row.Display;  
            }  
        }  
 
 
        grdRuns.ClientSettings.AllowExpandCollapse = true;  
        grdRuns.MasterTableView.HierarchyLoadMode = GridChildLoadMode.Client;  
        grdRuns.MasterTableView.HierarchyDefaultExpanded = false;  
        grdRuns.MasterTableView.DataKeyNames = new string[] { "PortfolioID", "ParentID" };  
        grdRuns.MasterTableView.SelfHierarchySettings.ParentKeyName = "ParentID";  
        grdRuns.MasterTableView.SelfHierarchySettings.KeyName = "PortfolioID";  
 
        grdRuns.EditCommand += new GridCommandEventHandler(grdRuns_EditCommand);  
        divGrid.Controls.Add(grdRuns);  
 
        grdRuns.DataSource = ApproveRunData;  
            } 
private class MyTemplate : ITemplate  
    {  
        //protected LiteralControl lControl;  
        protected Label label;  
        private string colname;  
 
        public MyTemplate(string cName)  
        {  
            colname = cName;  
        }  
 
        public void InstantiateIn(System.Web.UI.Control container)  
        {  
            //lControl = new LiteralControl();  
            //lControl.ID = "lControl";  
            //lControl.DataBinding += new EventHandler(lControl_DataBinding);  
 
            label = new Label();  
            label.ID = "templateColumnLabel";  
            label.DataBinding += new EventHandler(label_DataBinding);  
 
            container.Controls.Add(label);  
        }  
 
        void label_DataBinding(object sender, EventArgs e)  
        {  
            Label lbl = (Label)sender;  
            GridDataItem container = (GridDataItem)lbl.NamingContainer;  
 
            string sValue = ((DataRowView)container.DataItem)[colname].ToString();  
            double dValue = -1;  
            if (double.TryParse(sValue, out dValue))  
            {  
                string sTemp = String.Format("{0:n}", dValue);      //add commas as thousand separator  
                lbl.Text = sTemp.Substring(0, sTemp.IndexOf('.'));  //don't display digits after decimal point.  
                lbl.Style.Add("text-align", "left");                    //make the minus sign ('-') appear on the left of the number.  
 
            }  
            else lbl.Text = sValue;  
            if (sValue == "") lbl.Text = "&nbsp;";  
        }  
                      
        public void lControl_DataBinding(object sender, EventArgs e)  
        {  
            LiteralControl l = (LiteralControl)sender;  
            GridDataItem container = (GridDataItem)l.NamingContainer;  
 
            string sValue = ((DataRowView)container.DataItem)[colname].ToString();  
            double dValue = -1;  
            if (double.TryParse(sValue, out dValue))  
            {  
                string sTemp = String.Format("{0:n}", dValue);      //add commas as thousand separator  
                l.Text = sTemp.Substring(0, sTemp.IndexOf('.'));    //don't display digits after decimal point.  
                //l.Style.Add("text-align", "left");                    //make the minus sign ('-') appear on the left of the number.  
 
            }  
            else l.Text = sValue + "<br/>";  
 
            if (sValue == "") l.Text = "&nbsp;";  
 
 
            //l.Text = ((DataRowView)container.DataItem)[colname].ToString() + "<br />";  
        }  
    }  
 
    private class MyEditTemplate : ITemplate  
    {  
        protected LiteralControl lControl;  
        protected TextBox textBox;  
          
        private string colname;  
 
        public MyEditTemplate(string cName)  
        {  
            colname = cName;  
        }  
 
        public void InstantiateIn(System.Web.UI.Control container)  
        {  
            lControl = new LiteralControl();  
            lControl.ID = "lControl";  
            lControl.DataBinding += new EventHandler(lControl_DataBinding);  
            textBox = new TextBox();  
            textBox.ID = "templateColumnTextBox";  
            textBox.CssClass = "fieldUpdatePortal";  
            textBox.DataBinding += new EventHandler(textBox_DataBinding);  
              
            container.Controls.Add(textBox);  
        }  
 
        void textBox_DataBinding(object sender, EventArgs e)  
        {  
            TextBox tBox = (TextBox)sender;  
            GridDataItem container = (GridDataItem)tBox.NamingContainer;  
 
            string sValue = ((DataRowView)container.DataItem)[colname].ToString();  
            double dValue = -1;  
            if (double.TryParse(sValue, out dValue))  
            {  
                string sTemp = String.Format("{0:n}", dValue);      //add commas as thousand separator  
                tBox.Text = sTemp.Substring(0, sTemp.IndexOf('.')); //don't display digits after decimal point.  
                tBox.Style.Add("direction", "ltr");                 //make the minus sign ('-') appear on the left of the number.  
 
            }  
            else tBox.Text = sValue;  
 
        }  
          
        public void lControl_DataBinding(object sender, EventArgs e)  
        {  
            LiteralControl l = (LiteralControl)sender;  
            GridDataItem container = (GridDataItem)l.NamingContainer;  
            l.Text = ((DataRowView)container.DataItem)[colname].ToString() + "<br />";  
 
 
        }  
    }   
 

Thank you

tali.
tali
Top achievements
Rank 1
 answered on 18 May 2009
1 answer
77 views
Hi,

Is it possible to provide details for the next release(s)?  The SP2 and the next full release?

Thanks,


Richard
Paul
Telerik team
 answered on 18 May 2009
7 answers
188 views
Hi,

I don't understand how things works with images load by the css of the panelbar. I've used the default skin that I have modified and it's work well. But I don't understand how your css sprites works :

.RadPanelBar_ServicesEtu .rpLink
{
    background-color: #fdfdfd;
    background-image: url('PanelBar/RootItemBg.gif');
    border-color: #ebebeb;
}

For this example, you load "RootItemBg.gif" where there are three states of button. How he can know what state to load when there are no positionning numbers in the statement like :

#panel3b a:hover {background: transparent url(test-3.jpg) -172px -200px no-repeat;}

I've read this articles http://www.alistapart.com/articles/sprites/ to know how css sprites work but I don't understand your methods.

Thanks.



Alex Gyoshev
Telerik team
 answered on 18 May 2009
1 answer
214 views
Is there any way to get the RadMenu to execute a Server.Transfer instead of a Response.redirect when an item is clicked?  None of the menu items are going outside of the project and I like the cleanliness of the URL staying the same on every page.  Any help would be appreciated!


Thanks,

Marc
Paul
Telerik team
 answered on 18 May 2009
3 answers
385 views

I need to show list of questions in grid and their answers in details view when a person expnads question item. Below is how I set datasource of radGrid. How can i set the datasource of nested details grid now?



protected
void ShowQuestions()

 

{

 

try

 

 

 

 

{

 

    this.radGridQuestions.DataSource = this.questions;

 

}

 

 

catch

 

 

 

 

{

}

}

 

<

 

tk:RadGrid ID="radGridQuestions" runat="server" AutoGenerateColumns="False" ShowHeader="false" GridLines="None">

 

 

<MasterTableView DataKeyNames="Id">

 

 

<Columns>

 

 

<tk:GridTemplateColumn>

 

 

<ItemTemplate>

 

 

<table>

 

 

<tr>

 

 

<td style="width: 30px; vertical-align: top;">

 

 

<img src="<%# PostStatusImage(Container.DataItem)%>" alt="PostStatus" />

 

 

</td>

 

 

<td style="vertical-align: top;">

 

 

<asp:LinkButton ID="lbViewQuestion" runat="server" Text='<%# Eval("Title") %>' CommandArgument='<%# Eval("Id") %>'

 

 

CommandName="ViewQuestion"></asp:LinkButton>&nbsp; Posted On:&nbsp;<%# Eval("PostedDate") %>

 

 

</td>

 

 

</tr>

 

 

</table>

 

 

</ItemTemplate>

 

 

</tk:GridTemplateColumn>

 

 

</Columns>

 

 

<DetailTables>

 

 

<tk:GridTableView runat="server" DataKeyNames="Id">

 

 

<ParentTableRelation>

 

 

<tk:GridRelationFields DetailKeyField="ParentThreadId" MasterKeyField="Id" />

 

 

</ParentTableRelation>

 

 

<DetailTables>

 

 

</DetailTables>

 

 

</tk:GridTableView>

 

 

</DetailTables>

 

 

</MasterTableView>

 

 

</tk:RadGrid>

 

Sebastian
Telerik team
 answered on 18 May 2009
Narrow your results
Selected tags
Tags
+? more
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?