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

Following is my code for Page1 and Page2.
Page 1 is having a button under RadAjaxPanel, on the click of the button, user redirect to Page2 which actually spits .xls file and close himself.
User found himself on the same page Page1, because Page2 only spits xls in binary.

Problem:
After I click on button1 on Page1, busybox starts and continue to display even after I click "Save, Open or Cancel" button of file Download Dialogbox.

R&D:
I did some research and found that ResponseEnd is not firing, after we close File Download Dialogbox.

Page1:

<%

@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<%

@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

<!

DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<

html xmlns="http://www.w3.org/1999/xhtml">

<

head runat="server">

<title>Untitled Page</title>

<script type="text/javascript">

function requestStart(sender, eventArgs)

{

alert(

'Start');

}

function responseEnd(sender, eventArgs)

{

alert(

'End');

}

</script>

</

head>

<

body>

<form id="form1" runat="server">

<asp:ScriptManager ID="ScriptManager1" runat="server">

</asp:ScriptManager>

<telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" SkinID="apDefault"

LoadingPanelID="LoadingPanel1" ClientEvents-OnRequestStart="requestStart"

ClientEvents-OnResponseEnd="responseEnd"

Width="100%">

<br />

<br />

<br />

<br />

<asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click1"></asp:Button>

<br />

<br />

<br />

<br />

</telerik:RadAjaxPanel>

<telerik:RadAjaxLoadingPanel ID="LoadingPanel1" SkinID="lpDefault" runat="server">

<asp:Image ID="Image1" SkinID="imgLoading" runat="Server" />

</telerik:RadAjaxLoadingPanel>

</form>

</

body>

</

html>



Page1.aspx.cs

protected

void Button1_Click1(object sender, EventArgs e)

{

Response.Redirect(

"ExportSuccess.aspx");

}

================================PAGE2=======================

<%

@ Page Language="C#" AutoEventWireup="true" CodeFile="ExportSuccess.aspx.cs" Inherits="ExportSuccess" %>

 

<!

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>Untitled Page</title>

</

head>

<

body>

 

<form id="form1" runat="server">

 

<div>

 

</div>

 

</form>

</

body>

</

html>


Page2.aspx.cs

protected

void Page_Load(object sender, EventArgs e)

{

string filename = Server.MapPath("myfile.xls");

HttpContext context = this.Context;

context.Response.Buffer =

true;

context.Response.Clear();

context.Response.ClearContent();

context.Response.ClearHeaders();

if (File.Exists(filename))

{

context.Response.ContentType =

"application/vnd.ms-excel";

context.Response.AddHeader(

"content-disposition", "attachment;filename=myfile.xls");

context.Response.TransmitFile(filename);

}

else

{

context.Response.Write(

"file not found");

}

context.Response.Flush();

context.Response.End();

}



Kevin Babcock
Top achievements
Rank 1
 answered on 31 Jul 2008
9 answers
338 views
Hi,
I have a Radgrid which i bound with a data table. The data is shown properly in the grid. Now when i click on Page values of grid, everything works fine. Now if I sort the column the Grid shows No Records for display. If I sort the Grid First, sorting happens but after Page click, the Grid again shows No Records for display.

So each action works fine individually but not if one action is done after another i.e. Paging-->Sorting or Sorting-->Paging, Grid shows No Record for display.
In Code behind, the Grid Datasource always shows Data.

Need help on urgent basis.

regards,

PN

Code:
ASPX PAGE:  
---------------  
 
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">  
                <AjaxSettings> 
                    <telerik:AjaxSetting AjaxControlID="RadGrid1">  
                        <UpdatedControls> 
                            <telerik:AjaxUpdatedControl ControlID="RadGrid1" /> 
                        </UpdatedControls> 
                    </telerik:AjaxSetting> 
                </AjaxSettings> 
            </telerik:RadAjaxManager> 
            <telerik:RadGrid ID="RadGrid1" Skin="Office2007" Width="97%" AllowSorting="True" 
             PageSize="15" ShowFooter="True" AllowPaging="True" AllowMultiRowSelection="True" runat="server" Gridlines="None"   
             OnNeedDataSource="RadGrid1_NeedDataSource">  
              <MasterTableView Width="100%" /> 
              <PagerStyle Mode="NextPrevAndNumeric" /> 
            </telerik:RadGrid> 
--------------------------------------------------------------------------  
 
Code Behind:  
--------------  
  protected void Page_Load(object sender, EventArgs e)  
        {  
 
        }  
        protected void RadGrid1_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)  
        {  
            DataTable dt=null;  
            dt=GetDataTable();  
            if(dt!=null)  
            RadGrid1.DataSource = dt;  
 
        }  
        private DataTable GetDataTable()  
        {  
            DataTable dt = null;  
            DataSet dsResults = Utility.SearchCategoryCards("Digital", Session["UserCompanyCode"].ToString());  
            if (dsResults != null && dsResults.Tables.Count > 0 && dsResults.Tables[0].Rows.Count > 0)  
            {  
                dt = dsResults.Tables[0]; ;  
                return dt;  
            }  
            else  
            {  
                return dt;  
            }  
        } 
Angie
Top achievements
Rank 1
 answered on 31 Jul 2008
1 answer
126 views
When a user clicks a button on my web page I want to create an instance of a Web User Control in my code behind, set the data source for a Rad Grid that is in the Web User Control, and then add the Web User Control to the controls collection on my page.  When I try to set the datasource for the grid, I get a NullReferenceException.  From what I can tell the grid is null.  The scenario works when the user control already exists on the web page, but not when I create the web user control in code.

I have a sample project if that will help.
Paul Bishop
Top achievements
Rank 1
 answered on 31 Jul 2008
10 answers
538 views

Hi,

I am using pager Mode="NextPrevNumericAndAdvanced" with PageSize

="10".

issue is:
enter 10 in change page size textbox and click on Change, OK data is visible
Click on Change again without doing anything else.

result: grid is empty.

What is noticed:
PageSizeChanged event does not fire on 2nd attempt.

Note: This behavior observed only for value 10.

Regards,
Vaibhav

 

Vladimir
Top achievements
Rank 1
 answered on 31 Jul 2008
7 answers
182 views
I have a RADGRID set up to display data from a SQLDataSource that calls a stored procedure.   During the coarse of work... the user may want to update data and have it reflected in the grid.  I have my update/refrsh button do a RADGRID1.reBind() but it doesnt seem to make the call to the stored procedure to get the new set of data.

Is there a thread already out there about this that someone could link me to? or perhaps throw some options my way. 

The grid is on a webform that is AJAX enabled.  works fine displaying the resulting data from the stored proc.  Just doesnt refresh with new data when forced to rebind.

thanks
Vladimir
Top achievements
Rank 1
 answered on 31 Jul 2008
1 answer
123 views
I've tried to follow all of th eonline examples, but one thing consistently fails: I cannot access any RadControls via the given Javascript.

I have a grid that I want to update from an open RadWindow. I am using the following example: 
http://www.telerik.com/DEMOS/ASPNET/Controls/Examples/Integration/GridAndWindow/DefaultCS.aspx?product=window

Here is my javascript:

function ShowForm(site, form, rowIndex) {

if (form == 'refViewer') {

var grid = window["<%= radData.ClientID %>"];
alert(grid);
alert(grid.MasterTableView);

// var rowControl = grid.MasterTableView.Rows[rowIndex].Control;
// grid.MasterTableView.SelectRow(rowControl, true);

}

window.radopen(site, form);

return false;
}

I find the grid no problem. But it fails on the grid.MasterTableView. I have yet, in any online example, been able to get the given Javascript to function. I have had to modify it myself to get it to work. In this case, I can manually find the mastertable by $get('radData_ctl00') but then it fails on the SelectRow method.

Is there some reference I am missing? I have the Q2 version of the controls, so I had hoped my problems from Q1 would go away.

Thanks!

Sean

Sean
Top achievements
Rank 2
 answered on 31 Jul 2008
2 answers
397 views

Here is my aspx:

                    <telerik:RadComboBox ID="RadComboBox1" Runat="server" 
                        DataSourceID="SqlDataSource1" DataTextField="addr_line_1"   
                        DataValueField="address_id" Skin="Sunset" Width="250px"   
                        OnSelectedIndexChanged="RadComboBox1_SelectedIndexChanged" AutoPostBack="True">  
                        <CollapseAnimation Duration="200" Type="OutQuint" /> 
                    </telerik:RadComboBox> 

And here is my code behind(c#):

    protected void RadComboBox1_SelectedIndexChanged(object o, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e)  
    {  
        if (RadComboBox1.SelectedItem != null)  
            lblAddrLine1.Visible = true;  
        lblAddrLine1.Text = String.Format("Address Line 1: '{0}'", RadComboBox1.SelectedItem.Text);  
 
    } 

   
I get this error in IE7:

Line:  605
Char:  13
Error:  Sys.WebForms.PageRequestManagerServerErrorException:  An unknown error occurred while processing the request on the server.  The status code returned from the server was:  500
Code: 0
URL:  this is the url of my site

Any ideas what could be causing this?

Thanks,
Greg

Chris
Top achievements
Rank 1
 answered on 31 Jul 2008
2 answers
95 views
Hi.  I am successfully setting the header text for a column in the code behind, like so:

protected void RadGrid_Subs_ItemDataBound(object sender, GridItemEventArgs e)  
        {  
            if (e.Item is GridHeaderItem)  
            {  
                GridHeaderItem header = (GridHeaderItem)e.Item;  
                header["linklabel"].Text = headerText;  
                  
            }  
        }   

The column code is this (the sortexpression is static):
<telerik:GridTemplateColumn SortExpression="linklabel" UniqueName="linklabel" ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left" > 
                    <ItemTemplate> 
                        <%# BuildLink(DataBinder.Eval(Container.DataItem, "linkID"), DataBinder.Eval(Container.DataItem, "linkLabel"), DataBinder.Eval(Container.DataItem, "forumID"), DataBinder.Eval(Container.DataItem, "isCase"))%> 
                    </ItemTemplate> 
                </telerik:GridTemplateColumn> 

The column header is not sortable.  If I hardcode the headertext, the sorting works fine.  Am I missing a step?

Thanks.
Angie
Top achievements
Rank 1
 answered on 31 Jul 2008
2 answers
343 views
Hi,
My users are changing the grid client-side (sort, filter, column order, etc).
What i would like to do is be able to save the grid layout, so when the page is reloaded, i can load these settings, so the grid looks the same as when the user left it. Is this possible ?
To xml or database ???

Thanks in advance
Mark
Mike
Top achievements
Rank 1
 answered on 31 Jul 2008
1 answer
113 views
I'm sucessfully using RadGrid and other Rad products in WSS 3.0 but can't get the scheduler to work.

Here's my test code trying to use a List as the datasource:

            <telerik:RadScheduler runat="server" ID="RadScheduler1" 
            Width="750px" Skin="Inox" 
            SelectedDate="2007-03-30" DayStartTime="08:00:00" DayEndTime="18:00:00"                    
            DataSourceID="spdsCalendar" DataKeyField="ID" DataSubjectField="Title" 
            DataStartField="MovementFromDate" DataEndField="MovementToDate" 
            SelectedView="WeekView">  
        </telerik:RadScheduler> 
        <sharepoint:SPDataSource DataSourceMode="List" 
            Scope="Default"   
            IncludeHidden="true"   
            ID="spdsCalendar" runat="server">  
            <SelectParameters> 
                <asp:Parameter Name="WebUrl" DefaultValue="/webname/" /> 
                <asp:Parameter Name="ListName" DefaultValue="mylist" /> 
            </SelectParameters> 
        </sharepoint:SPDataSource> 

This is in a custom user control within a web part. The user control runs fine without Scheduler, but when I put this code in a get a 'File not Found'.

I noticed there were some Telerik references in web.config SafeControls so I added the following:

<SafeControl Assembly="Telerik.Web.UI, Version=2008.1.619.20, Culture=neutral, PublicKeyToken=121fae78165ba3d4" Namespace="Telerik.Web.UI.Scheduler" TypeName="*" Safe="True" />

This didn't make any difference as I still get the error. Would the reference to the Skin be causing this? I presume the skin details are somehow built into the main Telerik dll.

cheers,

Steve
Steve
Top achievements
Rank 1
 answered on 31 Jul 2008
Narrow your results
Selected tags
Tags
+? more
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?