Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
84 views
I have a rad editor, and I use the template manager within it to help Product Writers write significant information in a short period of time. I'm using the recent version of the editor. When I add a template which contains HTML tables, and want to upper-left justify the left column, I right click on the table and go to "Cell Properties". I use the "ctrl" key to highlight all cells on the left hand side of the table (two column table). Select the alignment drop down, and change it to upper-left justification. After I click OK, it moves the ending strong tag from before the table definition, to after the table definition, making the whole table enveloped in a strong tag, making everything on the right side of the table, bold text. I know that it's because of the break points before the strong tag, because when I take them out, it stays in the same place. Can you answer the question of how come the </STRONG> tag moves? We never highlight above the table as we're using the table manager. When you highlight text, it might enclose break points inside of whatever text you're manipulating, which is how this became a problem.

-- Template
<P><FONT style="FONT-SIZE: 14px" color=#007dca><STRONG>Title of Object</STRONG></FONT><BR>Description of Object.<BR><BR><STRONG><FONT color=#007dca>Title of Object again for reference</FONT><BR><BR></STRONG> 
<TABLE> 
<TBODY> 
<TR> 
<TD style="WIDTH: 250px"> 
<UL class=ulolProdDesc> 
<LI><STRONG>Title 1</STRONG></LI></UL></TD> 
<TD>Desc 1</TD></TR> 
<TR> 
<TD style="WIDTH: 250px"> 
<UL class=ulolProdDesc> 
<LI><STRONG>Title 2</STRONG></LI></UL></TD> 
<TD>Desc 2</TD></TR> 
<TR> 
<TD style="WIDTH: 250px"> 
<UL class=ulolProdDesc> 
<LI><STRONG>Title 3</STRONG></LI></UL></TD> 
<TD>Desc 3</TD></TR> 
<TR> 
<TD style="WIDTH: 250px"> 
<UL class=ulolProdDesc> 
<LI><STRONG>Title 4</STRONG></LI></UL></TD> 
<TD>Desc 4</TD></TR> 
</TBODY></TABLE></P> 

Stanimir
Telerik team
 answered on 29 Apr 2010
1 answer
87 views
Hi, I am trying to add a new field (specifically a text box along with an associated  label) to the Node Inspector module and retreive the value of that text box in the code behind page.  Is there a way to do this??  (btw I have searched the forum(s) but could not find a way to do it)

Thanks.
Stanimir
Telerik team
 answered on 29 Apr 2010
1 answer
161 views
Dear telerik team
I use RadcomboBox and RadAjaxManager. RadcomboBox SelectedIndexChanged event. There is a problem if RadcomboBox RadAjaxManager using the commands in the SelectedIndexChanged method is not implemented correctly. And if you do not use RadAjaxManager, then use normally.
I started the project attached for your reference and help me solve the problem.
Sincerely

File :
http://www.mediafire.com/file/nb3gj4mytqz/AjaxTest.rar
Yana
Telerik team
 answered on 29 Apr 2010
1 answer
97 views
Hi,

I am using a RadGrid control in an radAjaxManager in a DNN environment.
The grid is databound to a DataSet.

The grids guts are similar to the cardview in the RadGrid examples which uses a Masterview and an Itemtemplate.

Here is the problem:
The pager mode is set to "NextPrevAndNumeric" and everything is working dandy...except when using the Prev and Next options.
It appears that they only recognize the first 2 pages no matter what the page size.

I can select the page number and get the correct page but, clicking the next or previous does not not behave as expected.
I can get the previous and next options to work properly if I set teh enableSEOPageing to true. However, this kills my PageSize from sticking as you page through the grids pages and so has been discarded in teh example.

Here is the markup:


                                <strong>TEST GRID</strong></p>  
                            <telerik:RadGrid ID="RadGrid3"  AllowPaging="True" OnNeedDataSource="RadGrid3_NeedDataSource"   
                                runat="server" GridLines="None" Width="100%" EnableViewState="true">  
                                <PagerStyle Position="TopAndBottom" AlwaysVisible="true" ShowPagerText="true" Mode="NextPrevAndNumeric"  ></PagerStyle>  
                                <MasterTableView ShowHeader="false" AllowPaging="True"  > 
                                    <ItemTemplate> 
                                        <asp:Panel runat="server" ID="ItemContainer" style="width: 645px;">  
                                            <table style="width: 645px;">  
                                                <tr> 
                                                    <td valign="top" class="style8" colspan="4">  
                                                        <asp:HyperLink runat="server" ID="HyperLink3" Text='<%#Eval("Product")%>' Font-Bold="True" 
                                                            NavigateUrl='<%#Eval("Url")%>' ToolTip="View Product"></asp:HyperLink> 
                                                    </td> 
                                                    <br /> 
                                                </tr> 
                                                <tr> 
                                                    <td width="25%" align="center">  
                                                        <asp:HyperLink ID="HyperLink2" runat="server" Text="" NavigateUrl='<%#Eval("Url")%>'>  
                                                            <asp:Image ID="rdlImage" BorderStyle="Solid" BorderColor="#8b847e" BorderWidth="1" 
                                                                runat="server" ImageUrl='<%# Eval("ImageUrl")%>' ToolTip="View Product" /></asp:HyperLink> 
                                                    </td> 
                                                    <td class="style9">  
                                                        <label style="font-family: Arial; font-size: 8pt">  
                                                            <b>Manufactuer:</b> 
                                                            <%#Eval("Manufacturer")%></label><br /> 
                                                        <label id="PNum" style="font-family: Arial; font-size: 8pt">  
                                                            <b>Part Number:</b> 
                                                            <%#Eval("Part Number")%></label><br /> 
                                                        <label style="font-family: Arial; font-size: 8pt">  
                                                            <b>Manfacturer Part Number:</b> 
                                                            <%#Eval("Man Part Number")%></label><br /> 
                                                        <label style="font-family: Arial; font-size: 8pt">  
                                                            <b>Description:</b> 
                                                            <%#Eval("Description")%></label>  
                                                    </td> 
                                                    <td valign="middle" align="center">  
                                                        <asp:Panel ID="pnlPrice" runat="server">  
                                                        </asp:Panel> 
                                                        <br /> 
                                                        <div style="border-width: 1px; border-style: dotted; background-color: #E2E2E2; text-align: center;  
                                                            width: 100px;"> 
                                                            <asp:HyperLink runat="server" ID="lViewProduct" Text=" View Product " Font-Bold="True" 
                                                                NavigateUrl='<%#Eval("Url")%>'></asp:HyperLink> 
                                                        </div> 
                                                        <br /> 
                                                        <div id="divAddToCart" runat="server">  
                                                            <a class="jsaddtocart" href='<%# ConstructAddToCartURL(Eval("ProductID"),Eval("VariantID")) %>'>  
                                                                <span class="jshideme">Add to cart</span></a><p> 
                                                                </p> 
                                                        </div> 
                                                    </td> 
                                                </tr> 
                                          </table>   
                                        </asp:Panel> 
                                    </ItemTemplate> 
                                </MasterTableView> 
                            </telerik:RadGrid> 

Thanks in advance!
Martin
Telerik team
 answered on 29 Apr 2010
1 answer
161 views
I'd like to nest a RadListBox in my RadGrid.  How can I link the parent RadGrid to the child RadListBox.  I tried using the "ParentTableRelation" code from below, but its not working.

<ParentTableRelation> 
     <telerik:GridRelationFields DetailKeyField="SEQN" MasterKeyField="SEQN" /> 
</ParentTableRelation> 

Is this something that needs to be done in the code-behind?

J
Sebastian
Telerik team
 answered on 29 Apr 2010
1 answer
123 views

I'm creating a new web application with Entity Framework. I want to use the following layered structure:

User Interface Layer

Business Object Layer

Interface

Entity Framework Layer

The Business Object Layer now implements the interface on bottom layer using the Entity Framework Objects.

In the user interface I use a Telerik component (radGrid) to show/edit/update/delete data. Now I can show entity data to user simply doing a simple (linq to entities) query like:

 var stabilimenti = from s in entities.Stabilimenti
                               select s;

My problem is to persist data on database when user changes them.

In my user page i want to catch the "RadGrid1_UpdateCommand" and in some way persist data modification. Debugging i've seen that at the update event i've lost all data modification (the program executes a Page_Load just before).

How can I persist modification? Have I to use an Entity DataSource and manually place there datas retrieved from Entity Framework entities? Or what else should I do?

Tsvetoslav
Telerik team
 answered on 29 Apr 2010
11 answers
1.0K+ views

 

Hi,

I am trying create a RadGrid by using clientside databinding feature.
My requirement
1. To display first few columns with the data retreived from database using the GridBoundColumn
2. The last 2 column should have "Select" and "Delete" hyperlink. On clicking this hyperlink i need to call the javascript to do some action in the client side. Also the javascript should have a knowledge on which row i clicked.

The problem i am facing
1. I tried with the GridClientSelectColumn but the problem is, RadGrid display only checkbox eventhough i set the ButtonType="LinkButton". I don't know how to display the "Select" text. I was expecting it to show the "Select" text by default or atleast to display the text defined in the "Text" attribute.
2. GridClientDeleteColumn displays the "Delete" link but i am not able to bind the column value to the CommandArgument so that i can know which row is clicked.
3. Also in both the option when i databind the Grid in the client side, both the column doesn't display the text. It first apears and then disapears after the client databind.
4. So I tried with the GridTemplateColumn with the html control in the ItemTemplate but I am not able to bind the data using 
        <telerik:GridTemplateColumn>
               <ItemTemplate>
                      <a href=javascript:rowSelected('<%# Eval("Text") %>') >Select</a> 
                </ItemTemplate>
         </telerik:GridTemplateColumn>
binder, because the data is not displayed.

Could you please let me know some solution or show some pointer to some sample for the following,
1. I want to display a grid with client side databinding with last 2 columns "Select" and "Delete" link button and on clicking this link i should call the javascript with the row information passed to the method.

Thank you for your support.
Sundar

Nikolay Rusev
Telerik team
 answered on 29 Apr 2010
1 answer
92 views
hi guys

i have radgrid and in it i have just 1 column that format is  telerik:GridTemplateColumn.
now i want to add Sort By Price and sort By Name to this column

how i can do that?

tnx

here is my grid code

 <telerik:GridTemplateColumn UniqueName="column1" 
               AllowFiltering="false"  ShowSortIcon="false"   
                Groupable="false"     
                ItemStyle-Font-Names="tahoma" ItemStyle-Font-Size="8"    
                HeaderStyle-Font-Size="8" HeaderStyle-Font-Names="tahoma">  
              <ItemTemplate> 
              <table cellpadding="0" cellspacing="0"  width="100%" style="border-style: none; border-width: 0px;margin:0px;padding:0px" border="0"   
                      ID="tblProductContent" runat="server">  
              <tr > 
              <td style="width:105px" valign="top">  
               <asp:Image  
                  ImageUrl='<%# Eval("PicPath") %>' 
                  Width="100px" Height="100px" 
                   ID="imgProduct" runat="server" /> 
                     
              </td> 
 
              <td> 
                <table cellpadding="0" cellspacing="0"  width="100%" style="border-style: none; border-width: 0px;margin:0px;padding:0px" border="0"   
                <tr> 
                    <tr> 
                        <td valign="top">  
                            <asp:Label ID="Label1" runat="server" Font-Size="10"   
                                Text='<%# Eval("Title") %>'></asp:Label> 
                            <br /> 
                            <br /> 
                        </td> 
                    </tr> 
                    <tr> 
                        <td valign="top">  
                            <div style="margin: 5px;padding:5px; background-color: #F8F8F8; border: 1px solid #DADADA;width:470px">  
                                <asp:Label ID="Label2" runat="server" Font-Size="8" ForeColor="#666666"   
                                    Text='<%# Eval("Des") %>'></asp:Label> 
                                <br /> 
                                <br /> 
                                <div ID="moreInfo" onclick='<%# "openWin("+Eval("ProductID")+")"%>'   
                                    style="cursor:pointer;color:Blue">  
                                    <asp:Label ID="Label3" runat="server"   
                                        Text="<%$ Resources:Resource, MoreInfo %>"></asp:Label> 
                                </div> 
                                <br /> 
                            </div> 
                        </td> 
                    </tr> 
                    <tr> 
                        <td valign="top">  
                            <asp:Label ID="Label5" runat="server" ForeColor="Red"   
                                Text="<%$ Resources:Resource, Price %>"></asp:Label> 
                            <asp:Label ID="Label4" runat="server" Font-Size="7pt" ForeColor="Red"   
                                Text='<%# Eval("Cost") %>'></asp:Label> 
                            <br /> 
                        </td> 
                    </tr> 
                    <tr> 
                        <td valign="top">  
                            <table> 
                                <tr> 
                                    <td> 
                                        <telerik:RadNumericTextBox ID="txtCount" runat="server"   
                                            EmptyMessage="<%$ Resources:Resource, Count %>"   
                                            EmptyMessageStyle-HorizontalAlign="Center" Font-Names="tahoma" Font-Size="8"   
                                            HoveredStyle-HorizontalAlign="Center" InvalidStyleDuration="100"   
                                            MaxValue="32760" MinValue="0" NegativeStyle-HorizontalAlign="NotSet"   
                                            ShowSpinButtons="True" Skin="Office2007" Type="Number" Width="80px">  
                                            <FocusedStyle HorizontalAlign="Center" /> 
                                            <HoveredStyle HorizontalAlign="Center" /> 
                                            <EmptyMessageStyle HorizontalAlign="Center" /> 
                                            <NegativeStyle HorizontalAlign="Center" /> 
                                            <EnabledStyle HorizontalAlign="Center" /> 
                                            <NumberFormat AllowRounding="True" DecimalDigits="0"   
                                                KeepNotRoundedValue="False" /> 
                                        </telerik:RadNumericTextBox> 
                                        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"   
                                            ControlToValidate="txtCount" ErrorMessage="*"   
                                            ValidationGroup='<%# Eval("ProductID") %>'></asp:RequiredFieldValidator> 
                                    </td> 
                                    <td> 
                                        <asp:Button ID="btnAddToBasket" runat="server"   
                                            CommandArgument='<%# Eval("ProductID") %>' CommandName="AddToBasket"   
                                            Text="<%$ Resources:Resource, AddToBasket %>"   
                                            ValidationGroup='<%# Eval("ProductID") %>' /> 
                                    </td> 
                                </tr> 
                            </table> 
                        </td> 
                    </tr> 
                </tr> 
                   
                </table> 
              </td> 
              </tr> 
              </table> 
               <hr style="size:landscape;width:635px; color: #688CAF; opacity:0.4;filter:alpha(opacity=40)" /> 
 
              </ItemTemplate> 
 
 
 
<HeaderStyle Font-Names="tahoma" Font-Size="8pt" Width="15%"></HeaderStyle> 
<ItemStyle Font-Names="tahoma" Font-Size="8pt" Width="15%"></ItemStyle> 
              </telerik:GridTemplateColumn> 
Princy
Top achievements
Rank 2
 answered on 29 Apr 2010
1 answer
62 views
For instance in the http://demos.telerik.com/aspnet-ajax/treeview/examples/applicationscenarios/directorystructure/defaultcs.aspx,
if you click several times very quickly on the Custom Attributes folder the loading indicator keeps being shown. I'm trying to find a suitable solution for this by using hideLoadingStatus() but it just hides the last Loading indicator that was loaded and the other ones stay there.
Any ideas?
Regards,

Mariano Liceaga
Yana
Telerik team
 answered on 29 Apr 2010
0 answers
157 views

I am planning to construct Radscheduler in the "Class Detail Schedule" section. As you might can see from the code, other control is referencing user control. Is there anyway to build RadScheduler in the page without using user control. how it can be implemented and how to assign the datasource. thanks

 

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Collections.Generic;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using DEET.StudentLearningProfile.CSharp.ClassLibrary;
using DEET.StudentLearningProfile.ViewPresenter.ClassManagement.Views;
using Microsoft.Practices.ObjectBuilder;
using NetTiers.Entities;
using Telerik.Web.UI;
using System.Globalization;
using System.Threading;

public partial class ClassManagement_Classes : Microsoft.Practices.CompositeWeb.Web.UI.Page,
                                             

DEET.StudentLearningProfile.ViewPresenter.ClassManagement.Views.IClasses
{
    #region Private members

    private ClassesPresenter presenter;

    #endregion

    [CreateNew]
    public ClassesPresenter Presenter
    {
        set
        {
           
            this.presenter = value;
            this.presenter.View = this;
        }
    }

    protected override void OnPreRender(EventArgs e)
    {
        //BuildSchedule();
        base.OnPreRender(e);
       
    }

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.IsPostBack)
        {
            this.presenter.OnViewInitialized();
        }
        this.presenter.OnViewLoaded();
        BuildClass();
       
       
    }

    public List<ClassSchedulePeriod> ClassScheduleCollection
    {
        set
        {
            //RadScheduler1.DataSource = value;
        }
    }
    // Build class view regardless whether or not a schedule attached 
    public void BuildClass()
    {
        // Get all the class views associated with a given student ID
        // In here, class IDs will not be duplicated, it is one student ID to many class IDs relationship
        VList<NetTiers.Entities.VwStudentsByClass> data = presenter.GetAllClassesByStudentId();
        NetTiers.Services.SafeNameClassService classService = new NetTiers.Services.SafeNameClassService();

        // Get class IDs
        IList<long> classes = new List<long>();
        foreach (NetTiers.Entities.VwStudentsByClass aClass in data)
        {
            if (!classes.Contains(aClass.ClassId))
            {
                classes.Add(aClass.ClassId);
            }
        }

        Telerik.Web.UI.RadPanelBar panelBar = new Telerik.Web.UI.RadPanelBar();
        panelBar.Skin = "WebBlue";
        panelBar.ID = "panelBar";
        panelBar.Width = Unit.Percentage(97);

        foreach (long classId in classes)
        {
            // Going through one class at each loop

            // It is not necessary to retrieve the rows to tempData based on ClassId
            // Also it is not ncessary to calculate how many student groups a class has
            // However, here, it follows the coding style it already has
            /////////////////////////////////////////////////////////////////////////////////////////////
            VList<NetTiers.Entities.VwStudentsByClass> tempData = data.FindAll("ClassId", classId, true);
            IList<long> groups = new List<long>();

            // Find out how many student groups a class has
            foreach (NetTiers.Entities.VwStudentsByClass aClass in tempData)
            {
                if (!groups.Contains(aClass.StudentGroupId))
                {
                    groups.Add(aClass.StudentGroupId);               
                }
            }

            //
            if (groups.Count > 1)
            tempData = tempData.FindAll("StudentGroupId", groups[0], true);
          

            ////////////////////////////////////////////////////////////////////////////////////////////

 

            SafeNameClass currentClass = classService.GetByClassId(classId);
            classService.DeepLoad(currentClass);

            //modify the class name to set Uppercase letter
            CultureInfo cultureInfo = Thread.CurrentThread.CurrentCulture;
            TextInfo txtInfo = cultureInfo.TextInfo;

            RadPanelItem panelItem = new RadPanelItem(txtInfo.ToUpper(tempData[0].ClassName));
            panelItem.Attributes.CssStyle.Add(HtmlTextWriterStyle.FontWeight, "bold");
            panelItem.Attributes.CssStyle.Add(HtmlTextWriterStyle.FontSize, "12px"); 
           

            // Expand the panel item
            panelItem.Expanded = false;
            panelItem.Value = "panelItem";
           

            System.Drawing.Color background = System.Drawing.Color.FromArgb(150, 120, 230);
           
            RadPanelItem classDetailsPanelItem = new RadPanelItem("Class Details");
            RadPanelItem classAssignmentPanelItem = new RadPanelItem("Class Assignment / Homework");
            RadPanelItem classNoticePanelItem = new RadPanelItem("Class Notices");
            RadPanelItem classSchedulePanelItem = new RadPanelItem("Class Schedule");
            RadPanelItem classDetailSchedulerPanelItem = new RadPanelItem("Class Detail Schedule");

            classDetailSchedulerPanelItem.BackColor = background;
            classDetailsPanelItem.BackColor = background;
            classNoticePanelItem.BackColor = background;
            classAssignmentPanelItem.BackColor = background;
            classSchedulePanelItem.BackColor = background;
            classDetailsPanelItem.Attributes.CssStyle.Add(HtmlTextWriterStyle.FontWeight, "bold");
            classSchedulePanelItem.Value = "template";

            ClassScheduleTemplate classScheduleTemp = new ClassScheduleTemplate();
           

classScheduleTemp.LoadUserControl(this.LoadControl("~/ClassManagement/Controls/StudentViewClassSchedule.ascx"));

            ClassAssignmentTemplate classAssignmentTemp = new ClassAssignmentTemplate();
           

classAssignmentTemp.LoadUserControl(this.LoadControl("~/ClassManagement/Controls/StudentViewClassAssignment.ascx"));

            ClassNoticeTemplate classNoticeTemp = new ClassNoticeTemplate();
           

classNoticeTemp.LoadUserControl(this.LoadControl("~/ClassManagement/Controls/StudentViewClassNotices.ascx"));
           
            //ClassDetailsTemplate classDetailsTemp = new ClassDetailsTemplate();
           

//classDetailsTemp.LoadUserControl(this.LoadControl("~/ClassManagement/Controls/StudentViewClassDetails.ascx"));
            //classDetailsTemp.ClassDetails(currentClass);

            classScheduleTemp.SetScheduleDataSource(presenter.GetClassScheduleByClassId(classId));
            classNoticeTemp.SetNoticesDataSource(presenter.GetClassNoticeByClassId(classId));
            classAssignmentTemp.SetAssignmentDataSource(presenter.GetAssignmentByClassId(classId));
            //this.presenter.GetTimetableDataSource((long)SessionObject.ManagedUserId);

            classAssignmentPanelItem.ItemTemplate = classAssignmentTemp;
            classSchedulePanelItem.ItemTemplate = classScheduleTemp;
            classNoticePanelItem.ItemTemplate = classNoticeTemp;
            //classDetailsPanelItem.ItemTemplate = classDetailsTemp;
            //classDetailSchedulerPanelItem.ItemTemplate = classScedulerViewTemp;

            //panelItem.Items.Add(classDetailsPanelItem);

            panelItem.Items.Add(classSchedulePanelItem);
            panelItem.Items.Add(classNoticePanelItem);
            panelItem.Items.Add(classAssignmentPanelItem);
            panelItem.Items.Add(classDetailSchedulerPanelItem);
            panelBar.Items.Add(panelItem);
        }

        ClassPlaceHolder.Controls.Add(panelBar);

    }

    // Build class view which has at least one schedule attached to it
    public void BuildSchedule()
    {
        // Not every class that a student belongs to has attached schedules.
        // Get all the ClassSchedule views associated with a given student ID
        // One class may have more than one schedule attached to it, so in this case, it considered as two different

views
        VList<NetTiers.Entities.VwStudentClassSchedule> data = presenter.GetClassByStudentId();
        NetTiers.Services.SafeNameClassService classService = new NetTiers.Services.SafeNameClassService();
       
        // Get class IDs, but only those classes have attached schedules
        // One class may have more than one attached schedule, this process will get rid of duplicates class IDs
        IList<long> classes = new List<long>();
        foreach(NetTiers.Entities.VwStudentClassSchedule schedule in data){
            if (!classes.Contains(schedule.ClassId))
            {
                classes.Add(schedule.ClassId);
            }
        }

        Telerik.Web.UI.RadPanelBar panelBar = new Telerik.Web.UI.RadPanelBar();
        panelBar.Skin = "WebBlue";
        panelBar.ID = "panelBar";
        panelBar.Width = Unit.Percentage(97);

        foreach (long classId in classes)
        {
            // Going through one class at each loop
            // In all the ClassSchedule views, extracting out the views associated with only the given class ID in

each loop
            //
            VList<NetTiers.Entities.VwStudentClassSchedule> tempData = data.FindAll("ClassId",classId,true);
            IList<long> groups = new List<long>();

            // Find out how many student groups a class has
            foreach (NetTiers.Entities.VwStudentClassSchedule schedule in tempData)
            {
                if (!groups.Contains(schedule.StudentGroupId))
                {
                    groups.Add(schedule.StudentGroupId);

                }
            }

            // Only get the first student group comes up
            if (groups.Count > 1)
            tempData = tempData.FindAll("StudentGroupId", groups[0], true);
          
            SafeNameClass currentClass = classService.GetByClassId(classId);
            classService.DeepLoad(currentClass);

            RadPanelItem panelItem = new RadPanelItem(tempData[0].ClassName);
           
            panelItem.Expanded = false;
            panelItem.Value = "panelItem";

            //System.Drawing.Color background = System.Drawing.Color.FromArgb(176, 196, 222);
            System.Drawing.Color background = System.Drawing.Color.FromArgb(150, 120, 230);
           
            RadPanelItem classDetailsPanelItem = new RadPanelItem("Class Details");
            RadPanelItem classAssignmentPanelItem = new RadPanelItem("Class Assignment / Homework");
            RadPanelItem classNoticePanelItem = new RadPanelItem("Class Notices");
            RadPanelItem classSchedulePanelItem = new RadPanelItem("Class Schedule");
            RadPanelItem classDetailSchedulerPanelItem = new RadPanelItem("Class Detail Schedule");

            classDetailSchedulerPanelItem.BackColor = background;
            classDetailsPanelItem.BackColor = background;
            classNoticePanelItem.BackColor = background;
            classAssignmentPanelItem.BackColor = background;
            classSchedulePanelItem.BackColor = background;
            classDetailsPanelItem.Attributes.CssStyle.Add(HtmlTextWriterStyle.FontWeight, "bold");
            classSchedulePanelItem.Value = "template";
           
            ClassScheduleTemplate classScheduleTemp = new ClassScheduleTemplate();
           

classScheduleTemp.LoadUserControl(this.LoadControl("~/ClassManagement/Controls/StudentViewClassSchedule.ascx"));

            ClassAssignmentTemplate classAssignmentTemp = new ClassAssignmentTemplate();
           

classAssignmentTemp.LoadUserControl(this.LoadControl("~/ClassManagement/Controls/StudentViewClassAssignment.ascx"));

            ClassNoticeTemplate classNoticeTemp = new ClassNoticeTemplate();
           

classNoticeTemp.LoadUserControl(this.LoadControl("~/ClassManagement/Controls/StudentViewClassNotices.ascx"));

            //ClassDetailsTemplate classDetailsTemp = new ClassDetailsTemplate();
           

//classDetailsTemp.LoadUserControl(this.LoadControl("~/ClassManagement/Controls/StudentViewClassDetails.ascx"));
            //classDetailsTemp.ClassDetails(currentClass);

            //BuildClassScheduler();
           
            classScheduleTemp.SetScheduleDataSource(presenter.GetClassScheduleByClassId(classId));
            classNoticeTemp.SetNoticesDataSource(presenter.GetClassNoticeByClassId(classId));
            classAssignmentTemp.SetAssignmentDataSource(presenter.GetAssignmentByClassId(classId));
            //this.presenter.GetTimetableDataSource((long)SessionObject.ManagedUserId);

            classAssignmentPanelItem.ItemTemplate = classAssignmentTemp;
            classSchedulePanelItem.ItemTemplate = classScheduleTemp;
            classNoticePanelItem.ItemTemplate = classNoticeTemp;
            //classDetailsPanelItem.ItemTemplate = classDetailsTemp;
            //classDetailSchedulerPanelItem.ItemTemplate = classScedulerViewTemp;
            //panelItem.Items.Add(classDetailsPanelItem);
           
            panelItem.Items.Add(classNoticePanelItem);
            panelItem.Items.Add(classSchedulePanelItem);
            panelItem.Items.Add(classAssignmentPanelItem);
            panelItem.Items.Add(classDetailSchedulerPanelItem);

            panelBar.Items.Add(panelItem);
        }

        ClassPlaceHolder.Controls.Add(panelBar);
 
    }

    //public void BuildClassScheduler()
    //{
    //    RadScheduler clsScheduler = new RadScheduler();
    //    clsScheduler.DataSourceID = "";
    //    clsScheduler.DataStartField = "Start";
    //    clsScheduler.DataEndField = "End";
    //    clsScheduler.FirstDayOfWeek = DayOfWeek.Monday;
    //    clsScheduler.LastDayOfWeek = DayOfWeek.Sunday;
    //    clsScheduler.HoursPanelTimeFormat = "htt";
    //    clsScheduler.ValidationGroup="RadScheduler1";
    //    clsScheduler.DataSubjectField = "Subject";
    //    clsScheduler.DataRecurrenceField = "RecurrenceRule";
    //    clsScheduler.DataRecurrenceParentKeyField = "RecurrenceParentID";
    //    clsScheduler.Height = Unit.Pixel(600);
    //    clsScheduler.Width = Unit.Percentage(100);
    //    clsScheduler.SelectedView = SchedulerViewType.WeekView;
    //    clsScheduler.AllowDelete = false;
    //    clsScheduler.AllowEdit = false;
    //    clsScheduler.AllowInsert = false;
      

    //}
}

public class DownloadLinktemplate : ITemplate
{
    HyperLink dwnLink = new HyperLink();

    #region ITemplate Members

    public void InstantiateIn(Control container)
    {
        dwnLink.ID = "downloadLink";
        container.Controls.Add(dwnLink);
    }

    #endregion
}

public class ClassNoticeTemplate : ITemplate
{
    RadGrid noticesGrid = new RadGrid();
    Control c;

    public void InstantiateIn(Control container)
    {
        container.Controls.Add(c);
      
    }

    public void LoadUserControl(Control c)
    {
        this.c = c;
    }

    public void SetNoticesDataSource(TList<NetTiers.Entities.ClassNotice> data)
    {
        ((RadGrid)c.FindControl("ClassNoticeGrid")).ItemDataBound += noticesGrid_ItemDataBound;
        ((RadGrid)c.FindControl("ClassNoticeGrid")).DataSource = data;

    }

    #region Grid Events

    void noticesGrid_ItemDataBound(object sender, GridItemEventArgs e)
    {
        if (e.Item is GridDataItem)
        {
            ClassNotice currentClass = (ClassNotice)e.Item.DataItem;
            //UserInfo currentUser = (UserInfo)Session[EnumSessionVariables.UserInfo.ToString()];

            //bind the client script for launching the download
            if (currentClass.AttachedItem != null)
            {
                ((HyperLink)e.Item.FindControl("downloadLink")).ToolTip = "Download Attached File";
                ((HyperLink)e.Item.FindControl("downloadLink")).NavigateUrl = "filedownload.txt?" +

"tab=Classes&Notice=true&key=" +
                    e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["ClassNoticeId"] +
                    "&studentid=" + SessionObject.ManagedUserId + "&Notice=yes";
               
            }
            else
            {
                HyperLink downloadLink = e.Item.FindControl("downloadLink") as HyperLink;
                downloadLink.ImageUrl = "~/RadControls/Grid/Skins/Cancel.gif";
                downloadLink.ToolTip = "No attachment to download";
                downloadLink.Enabled = false;
            }
        }
    }

    #endregion

}

public class ClassAssignmentTemplate : ITemplate
{
    RadGrid assignmentGrid = new RadGrid();
    Control c;

    public void InstantiateIn(Control container)
    {
        container.Controls.Add(c);

    }

    public void LoadUserControl(Control c)
    {
        this.c = c;
    }

    public void SetAssignmentDataSource(TList<NetTiers.Entities.ClassAssignment> data)
    {
        ((RadGrid)c.FindControl("ClassAssignmentGrid")).ItemDataBound += classAssignmentGrid_ItemDataBound;
        ((RadGrid)c.FindControl("ClassAssignmentGrid")).DataSource = data;
    }

    #region Grid Events

    void classAssignmentGrid_ItemDataBound(object sender, GridItemEventArgs e)
    {
        if (e.Item is GridDataItem)
        {
            ClassAssignment currentClass = (ClassAssignment)e.Item.DataItem;
            //UserInfo currentUser = (UserInfo)Session[EnumSessionVariables.UserInfo.ToString()];

            //bind the client script for launching the download
            if (currentClass.Attachment != null)
            {
                ((HyperLink)e.Item.FindControl("downloadLink")).ToolTip = "Download Attached File";
                ((HyperLink)e.Item.FindControl("downloadLink")).NavigateUrl = "filedownload.txt?" +

"tab=Classes&Assignment=true&key=" +
                    e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["AssignmentId"] +
                    "&studentid=" + SessionObject.ManagedUserId;
               
            }
            else
            {
                HyperLink downloadLink = e.Item.FindControl("downloadLink") as HyperLink;
                downloadLink.ImageUrl = "~/RadControls/Grid/Skins/Cancel.gif";
                downloadLink.ToolTip = "No attachment to download";
                downloadLink.Enabled = false;
            }
        }
    }
    #endregion

}

public class ClassScheduleTemplate : ITemplate
{

    #region ITemplate Members
    RadGrid scheduleGrid = new RadGrid();
    Control userControl;

    public void LoadUserControl(Control c)
    {
        userControl = c;
    }

    public void InstantiateIn(Control container)
    {
        container.Controls.Add(userControl);
    }

    public void SetScheduleDataSource(TList<NetTiers.Entities.ClassSchedule> data)
    {
        ((RadGrid)userControl.FindControl("ClassScheduleGrid")).DataSource = data;
        ((RadGrid)userControl.FindControl("ClassScheduleGrid")).ItemDataBound += new

GridItemEventHandler(classScheduleGrid_ItemDataBound);
    }

    void classScheduleGrid_ItemDataBound(object sender, GridItemEventArgs e)
    {
        if (e.Item is GridDataItem)
        {
            ClassSchedule currentClass = (ClassSchedule)e.Item.DataItem;
            //UserInfo currentUser = (UserInfo)Session[EnumSessionVariables.UserInfo.ToString()];

            //bind the client script for launching the download
            if (currentClass.Attachment != null)
            {
                ((HyperLink)e.Item.FindControl("downloadLink")).ToolTip = "Download Attached File";
                ((HyperLink)e.Item.FindControl("downloadLink")).NavigateUrl = "filedownload.txt?" +

"tab=Classes&Schedule=true&key=" +
                    e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["ClassTimeId"] +
                    "&studentid=" + SessionObject.ManagedUserId +"&Schedule=yes";

            }
            else
            {
                HyperLink downloadLink = e.Item.FindControl("downloadLink") as HyperLink;
                downloadLink.ImageUrl = "~/RadControls/Grid/Skins/Cancel.gif";
                downloadLink.ToolTip = "No attachment to download";
                downloadLink.Enabled = false;
            }
        }

    }

    #endregion

}

public class ClassDetailsTemplate : ITemplate
{
    TextBox classOwner = new TextBox();
    LinkButton sharedresource = new LinkButton();
    TextBox classDescription = new TextBox();
    Label description = new Label();
    Label owner = new Label();

    Control c;

    public void InstantiateIn(Control container)
    {

        container.Controls.Add(c);

    }

    public void LoadUserControl(Control c)
    {
        this.c = c;
    }

    public void ClassDetails(SafeNameClass currentClass)
    {
        ((TextBox)c.FindControl("txtClassdescription")).Text = currentClass.ClassDescription;
        ((TextBox)c.FindControl("txtClassOwner")).Text = string.Format("{0} {1}",

currentClass.UserCreatedSource.FirstName, currentClass.UserCreatedSource.Surname);
        if (currentClass.ResourceSiteUrl == null)
        {
            ((HyperLink)c.FindControl("resourceSiteLnk")).Visible = false;
        }
        else
        {
            ((HyperLink)c.FindControl("resourceSiteLnk")).NavigateUrl = currentClass.ResourceSiteUrl;
        }
    }

}

 

 

Mark de Torres
Top achievements
Rank 1
 asked on 29 Apr 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?