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

Is it posible to have the RadAjaxLoadingPanel dim (I dont mean dimention I mean make darker) the background when its updating in the same way the RadWindow does when it pops up?

Andy
Shinu
Top achievements
Rank 2
 answered on 16 Dec 2009
2 answers
97 views
Help.
I can't identify what happen with the sort capability in my routines.
I would like that the data sort occurr in the client-side.
Thanks
Eloi
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="CSExcel.aspx.cs" Inherits="CSExcel" %> 
 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
<%@ Register Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" 
    Namespace="System.Web.UI" TagPrefix="asp" %> 
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
 
<html xmlns="http://www.w3.org/1999/xhtml">  
<head runat="server">  
    <title>Import Excel Data into GridView</title> 
</head> 
 
<body> 
    <form id="form1" runat="server">  
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server" EnableTheming="True">  
    </telerik:RadScriptManager> 
    <div> 
        <asp:FileUpload ID="FileUpload1" runat="server" /> 
        <asp:Button ID="btnUpload" runat="server" Text="Upload" OnClick="btnUpload_Click" /> 
        <br /> 
        <asp:Label ID="Label1" runat="server" Text="Has Header ?"></asp:Label> 
        <asp:RadioButtonList ID="rbHDR" runat="server">  
            <asp:ListItem Text="Yes" Value="Yes" Selected="True"></asp:ListItem> 
            <asp:ListItem Text="No" Value="No"></asp:ListItem> 
        </asp:RadioButtonList> 
    </div> 
    <br /> 
    <div> 
        <telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="True" AllowSorting="True" 
            GridLines="Horizontal" OnSortCommand="RadGrid1_SortCommand" PageSize="50">  
            <MasterTableView AutoGenerateColumns="True">  
                <DetailTables> 
                    <telerik:GridTableView runat="server" Width="100%">  
                        <Columns> 
                            <telerik:GridBoundColumn SortExpression="CodAluno" HeaderText="CodAluno" HeaderButtonType="TextButton" 
                                DataField="CodAluno" /> 
                            <telerik:GridBoundColumn SortExpression="CodTurma" HeaderText="CodTurma" HeaderButtonType="TextButton" 
                                DataField="CodTurma" /> 
                            <telerik:GridBoundColumn SortExpression="NomeAluno" HeaderText="NomeAluno" HeaderButtonType="TextButton" 
                                DataField="NomeAluno" /> 
                            <telerik:GridBoundColumn SortExpression="EmailAluno" HeaderText="EmailAluno" HeaderButtonType="TextButton" 
                                DataField="EmailAluno" /> 
                        </Columns> 
                    </telerik:GridTableView> 
                </DetailTables> 
                <RowIndicatorColumn> 
                    <HeaderStyle Width="20px"></HeaderStyle> 
                </RowIndicatorColumn> 
                <ExpandCollapseColumn> 
                    <HeaderStyle Width="20px"></HeaderStyle> 
                </ExpandCollapseColumn> 
                <SortExpressions> 
                    <telerik:GridSortExpression FieldName="CodAluno" SortOrder="Ascending" /> 
                </SortExpressions> 
            </MasterTableView> 
        </telerik:RadGrid> 
    </div> 
    </form> 
</body> 
</html> 
 
using System;  
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 System.Data;  
using System.Data.OleDb;  
using System.IO;  
using System.Configuration;  
using System.Drawing;  
using System.Text;  
using Telerik.Web.UI;  
 
public partial class CSExcel : System.Web.UI.Page   
{  
    public string FileName;  
 
    protected void Page_Load(object sender, EventArgs e)  
    {  
 
    }  
    protected void btnUpload_Click(object sender, EventArgs e)  
    {  
        if (FileUpload1.HasFile)  
        {  
            string FileName = Path.GetFileName(FileUpload1.PostedFile.FileName);  
            string Extension = Path.GetExtension(FileUpload1.PostedFile.FileName);  
            string FolderPath = ConfigurationManager.AppSettings["FolderPath"];  
            string FilePath = Server.MapPath(FolderPath + FileName);  
            FileUpload1.SaveAs(FilePath);  
            Import_To_Grid(FilePath, Extension, rbHDR.SelectedItem.Text);  
        }  
    }  
    //  
    private void Import_To_Grid(string FilePath, string Extension, string isHDR)  
    {  
        string conStr="";  
        switch (Extension)  
        {  
            case ".xls"//Excel 97-03  
                conStr = ConfigurationManager.ConnectionStrings["Excel03ConString"].ConnectionString;  
                break;  
            case ".xlsx"//Excel 07  
                conStr = ConfigurationManager.ConnectionStrings["Excel07ConString"].ConnectionString;  
                break;  
        }  
        conStr = String.Format(conStr, FilePath, isHDR);  
        OleDbConnection connExcel = new OleDbConnection(conStr);  
        OleDbCommand cmdExcel = new OleDbCommand();  
        OleDbDataAdapter oda = new OleDbDataAdapter();  
        DataTable DadosImportados = new DataTable();   
        cmdExcel.Connection = connExcel;  
 
        //Get the name of First Sheet  
        connExcel.Open();  
        DataTable dtExcelSchema;  
        dtExcelSchema = connExcel.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null);  
        string SheetName = dtExcelSchema.Rows[0]["TABLE_NAME"].ToString();  
        connExcel.Close();  
 
        //Read Data from First Sheet  
        connExcel.Open();  
        cmdExcel.CommandText = "SELECT * From [" + SheetName + "]";  
        oda.SelectCommand = cmdExcel;  
        oda.Fill(DadosImportados);  
        connExcel.Close();   
 
        //Bind Data to GridView  
        RadGrid1.DataSource = DadosImportados;  
        RadGrid1.DataBind();  
    }  
    //  
      
    //  
    protected void PageIndexChanging(object sender, GridViewPageEventArgs e)  
    {  
        string FolderPath = ConfigurationManager.AppSettings["FolderPath"];  
        string Extension = Path.GetExtension(FileName);  
        string FilePath = Server.MapPath(FolderPath + FileName);  
 
        Import_To_Grid(FilePath, Extension, rbHDR.SelectedItem.Text);  
        RadGrid1.CurrentPageIndex = e.NewPageIndex;  
        RadGrid1.DataBind();  
 
    }  
    //protected void RadGrid1_SortCommand(object source, Telerik.Web.UI.GridSortCommandEventArgs e)  
    //{  
    //    GridSortExpression expression = new GridSortExpression();  
    //    expression.FieldName = "CodAluno";  
    //    expression.SortOrder = GridSortOrder.Descending;  
    //    RadGrid1.MasterTableView.SortExpressions.AddSortExpression(expression);  
    //    RadGrid1.MasterTableView.Rebind();   
    //}  
    //  
    protected void RadGrid1_SortCommand(object source, GridSortCommandEventArgs e)  
    {  
        GridTableView tableView = e.Item.OwnerTableView;  
         
            e.Canceled = true;  
            GridSortExpression expression = new GridSortExpression();  
            expression.FieldName = "EmployeeID";  
            if (tableView.SortExpressions.Count == 0 ||  
                tableView.SortExpressions[0].FieldName != "EmployeeID")  
            {  
                expression.SortOrder = GridSortOrder.Descending;  
            }  
            else if (tableView.SortExpressions[0].SortOrder == GridSortOrder.Descending)  
            {  
                expression.SortOrder = GridSortOrder.Ascending;  
            }  
            else if (tableView.SortExpressions[0].SortOrder == GridSortOrder.Ascending)  
            {  
                expression.SortOrder = GridSortOrder.None;  
            }  
            tableView.SortExpressions.AddSortExpression(expression);  
            tableView.Rebind();  
          
    }   
 
}  
 

 

Eloi
Top achievements
Rank 1
 answered on 16 Dec 2009
1 answer
96 views
Hi

when i add the rad  editor web part to my page , it gets added but only with title. i cant see the any editor controls inside its blank ... did i miss anything when adding .?? 

Downloaded :  RadEditorMOSS_5_6_1.zip
Lini
Telerik team
 answered on 16 Dec 2009
3 answers
293 views
I am trying to render a textbox for each day of a calendar, but I am getting an exception.

Page cannot be null. Please ensure that this operation is being performed in the context of an ASP.NET request.

Can someone tell me how to accomplish this?

<telerik:RadCalendar ID="calendar" Width="500px" Height="400px" runat="server" OnDayRender="calendar_DayRender">  
            <CalendarDayTemplates> 
                <telerik:DayTemplate ID="templateMinutes">  
                    <Content> 
                        <telerik:RadTextBox ID="txtMinutes" runat="server" Columns="5">  
                        </telerik:RadTextBox> 
                    </Content> 
                </telerik:DayTemplate> 
            </CalendarDayTemplates> 
        </telerik:RadCalendar> 
Mira
Telerik team
 answered on 16 Dec 2009
1 answer
150 views
Hi,

I'm trying to find a basic example showing how to implement a foreign key lookup in the RadGrid. I have seen several examples of adding a combo to the grid, but can't find any real world examples that link a primary table with a foreign key table.

I have managed to get the lookup combo populated whilst in add/edit mode, but in the main grid it still shows the FK Id instead of the text field, although in trying to get it to work, I now seem to have broken the edit mode.

Basically I have..

[Contacts]
(pk) ContactID
(fk) ContactTypeID
ContactName
ContactNumber
...

[ContactTypes]
(pk) ContactTypeID
ContactType


The Grid columns should be..

ContactType, ContactName, ContactNumber, ...

In Add/Edit mode, ContactType should be a combo populated from the ContactTypes table.

thanks

Cesare
Yavor
Telerik team
 answered on 16 Dec 2009
1 answer
99 views
I've got a requirement to support clients in Third World areas.  Bandwidth is a critical issue.
I've got a radCastTabStrip and am finding that it is creating a lot of unnecessary markup in the browser (I've got several other Telerik RAD controls as well which likely have a similar problem) .
I think its creating a lot of bloated ViewSpace, but I know that the radTabStrip is creating a chain of nested span tags for each item.
Is there a way to strip out all the markup tags so that I can just use my own CSS stylesheets?
Are there any other suggestions you can offer to optimize RAD controls for low bandwidth?

A related question, as is, each <li>, <a>, and <span> tag created by the radTabStrip has its own CSS class explicitly added.
For low bandwidth, this is serious bloat.  Is there a way to remove these so that I can assign CSS based on the radTabStrip's own id/class?
T. Tsonev
Telerik team
 answered on 16 Dec 2009
2 answers
264 views
<telerik:RadGrid ID="RadGrid1" ShowGroupPanel="false" DataSourceID="MediaRelatedDS" Skin="Default" 
            AllowPaging="True" runat="server" AllowSorting="false" OnDataBound="RadGrid1_DataBound" OnPreRender="RadGrid1_PreRender" 
            OnItemDataBound="RadGrid1_ItemDataBound" AllowFilteringByColumn="false" PageSize="10" ShowHeader="False"
            <PagerStyle Mode="NumericPages" /> 
            <MasterTableView TableLayout="Fixed"  
                    nomasterrecordstext="&lt;b class=&quot;noRecords&quot;&gt;No records to display.&lt;/b&gt; &lt;br /&gt;&lt;br /&gt;"
         
       <ItemTemplate> <%# (((GridItem)Container).ItemIndex > 0) ? "</td></tr></table>" : ""%> 
                            <asp:Repeater ID="repPhoto" runat="server"
                     <ItemTemplate> 
                     <div class="mediaThumb"><rel="lightbox-gallery<%#(Eval("PrimaryKeyID").ToString())%>" href="/uploads/images/MediaCoverage/<%#(Eval("Image").ToString()) %>" class="highslide" onclick="return hs.expand (this, { wrapperClassName: 'wide-border'})">thmb</div> 
                     </ItemTemplate> 
                     </asp:Repeater> 


and i am assigning the datasource in the back end code:

    protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) 
    { 
 
        int itemCount = (sender as RadGrid).MasterTableView.GetItems(GridItemType.Item).Length + (sender as RadGrid).MasterTableView.GetItems(GridItemType.AlternatingItem).Length; 
 
        foreach (GridItem item in (sender as RadGrid).Items) 
        { 
                string itemID = "1"
 
                Repeater repPhoto = (Repeater)e.Item.FindControl("repPhoto"); 
 
               DataTable ds = getMediaImages(itemID); 
 
                repPhoto.DataSource = ds; 
                repPhoto.DataBind(); 
 
        } 
    } 


Keeps throwing "Object reference not set to an instance of an object." I assume that it is not finding the nested repeater!

Please help
jason walsh
Top achievements
Rank 1
 answered on 16 Dec 2009
1 answer
105 views
Hello,

I want to create telerik raddock from client side using javascript. can anyone has idea how to do this.

Thanks.
MP
Pero
Telerik team
 answered on 16 Dec 2009
2 answers
464 views
I'm wondering what does this property do.
Can this property stores the entire data source into it?
Is this scenario possible where I'll bind the grid on 1st load and not relying on any viewstate in code behind to persist the data source of a grid?
AereoN
Top achievements
Rank 1
 answered on 16 Dec 2009
2 answers
91 views
hi
when i use telerik rad grid with  Master/Detail table, some time i can`t see Expand icon. 
some time don`t show Add/Refresh icon in bottom of grid ... ! 

please help me :( !
 

Johny
Top achievements
Rank 1
 answered on 16 Dec 2009
Narrow your results
Selected tags
Tags
+? more
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?