Telerik Forums
UI for ASP.NET AJAX Forum
0 answers
220 views
Hi,

After Downloading the PDF file the Current page not Refreshing.


 already i have used the following code, but not working

            Image PreviewImg = (Image)Session["CheckPreviewImage1"];
            Document PDFPageSize = new Document(PageSize.A3);
            string FileName = "Some FileName";

            string path = Server.MapPath("PrintCheckPDFfiles") + "\\" + FileName + ".pdf"; ;
            PdfWriter.GetInstance(PDFPageSize, new FileStream(path, FileMode.OpenOrCreate));
            PDFPageSize.Open();
            iTextSharp.text.Image pdfimg = iTextSharp.text.Image.GetInstance(PreviewImg, System.Drawing.Imaging.ImageFormat.Gif);
            PDFPageSize.Add(pdfimg);
            PDFPageSize.Close();

            byte[] bytes = File.ReadAllBytes(path);
            HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=" + FileName + ".pdf");
            //Response.Buffer = true;
            Response.Charset = "";
            Response.Cache.SetCacheability(HttpCacheability.NoCache);
            Response.BinaryWrite(bytes);
            HttpContext.Current.Response.ContentType = "application/pdf";
            HttpContext.Current.Response.End();

            Response.Redirect("PageName.aspx");
  
             for Refreshing the page after last line i used the above statement( Response.Redirect("PageName.aspx");)



Venkateswarlu
Top achievements
Rank 1
 asked on 04 Jul 2013
7 answers
236 views
Hi All,

I want to have a chart with 3 line series based on the data below where the first column is the series, the second is the x axis and the 3rd is the y axis value.

Can chart series be done like this yet?  If not is there any fudge with datasets that I can use to pull the data in?

Regards

Jon

2 2013-04-08  9
2 2013-04-09  2
2 2013-04-10  4
3 2013-04-07  2
6 2013-04-08  5
6 2013-04-09  6
6 2013-04-10  2
Lidiya
Top achievements
Rank 1
 answered on 04 Jul 2013
6 answers
186 views
Hey people...

I have an issue with a user control I have created which is meant to provide search results through the use of a radgrid.

I have pasted the code below. As you will see, I have a button which causes a post back and a radgrid (bound to an objectdatasource) to show the results. The grid is configured to enable sorting and paging. There are other controls on the user control(e.g. comboxboxes and textboxes) which are the fields used to provide search criteria.

The problem I am having is that the page and grid loads fine with initial search results- all events are fired and the expected result is shown, then if I do a search/sort/page change it still works fine but the second and all subsequent postbacks (search/sort/page change)  raise all the events but the results aren't being shown in the browser. I also don't see any exceptions being raised- the databinding seems to run correctly. All the parameters passed to the search method are correct.

If I remove the radajaxpanel around it all, it works fine (but with all the full page refreshes). I have tried to use RadAjaxManager/proxy and still get the exact same result. Also tried manual binding and still no luck.

<telerik:RadAjaxPanel ID="ajaxpnlSearch" runat="server"
            <div class="form-row"
                <div class="float-left" style="width: 100%;"
                    <asp:Button Text="Search" class="search" runat="server" ID="btnSearch" OnClick="btnSearch_Click" /> 
                </div> 
                <div class="clear no-text"
                </div> 
            </div> 
            <div class="clear no-text"
            </div> 
            <telerik:RadGrid ID="grdSearchResults" runat="server" Width="100%" AllowPaging="True" 
                AllowSorting="True" DataSourceID="odsOpportunities" GridLines="None"
                <MasterTableView AutoGenerateColumns="False" DataSourceID="odsOpportunities" DataKeyNames="OppId" 
                    EnableViewState="true"
                    <Columns> 
                        <telerik:GridBoundColumn DataField="OppId" HeaderText="OppId" SortExpression="OppId" 
                            UniqueName="OppId" DataType="System.Int64"
                        </telerik:GridBoundColumn> 
                        <telerik:GridBoundColumn DataField="BusinessName" HeaderText="BusinessName" ReadOnly="True" 
                            SortExpression="BusinessName" UniqueName="BusinessName"
                        </telerik:GridBoundColumn> 
                        <telerik:GridBoundColumn DataField="ContactName" HeaderText="ContactName" SortExpression="ContactName" 
                            UniqueName="ContactName" ReadOnly="True"
                        </telerik:GridBoundColumn> 
                        <telerik:GridBoundColumn DataField="OppExpireDate" DataType="System.DateTime" HeaderText="OppExpireDate" 
                            SortExpression="OppExpireDate" UniqueName="OppExpireDate"
                        </telerik:GridBoundColumn> 
                        <telerik:GridBoundColumn DataField="CreatedDate" DataType="System.DateTime" HeaderText="CreatedDate" 
                            SortExpression="CreatedDate" UniqueName="CreatedDate"
                        </telerik:GridBoundColumn> 
                        <telerik:GridBoundColumn DataField="CreatedBy" DataType="System.Int32" HeaderText="CreatedBy" 
                            SortExpression="CreatedBy" UniqueName="CreatedBy"
                        </telerik:GridBoundColumn> 
                    </Columns> 
                </MasterTableView> 
                <ClientSettings> 
                    <Selecting AllowRowSelect="True" /> 
                </ClientSettings> 
            </telerik:RadGrid> 
            <asp:ObjectDataSource ID="odsOpportunities" runat="server" OldValuesParameterFormatString="original_{0}" 
                SelectMethod="Search" TypeName="Hub.BLL.Opportunity.Opportunity"
                <SelectParameters> 
                    <asp:ControlParameter ControlID="txtOppId" Name="inOppId" PropertyName="Text" Type="Int32" /> 
                    <asp:ControlParameter ControlID="cmbPartner" Name="inPartnerId" PropertyName="SelectedValue" 
                        Type="Int32" /> 
                    <asp:ControlParameter ControlID="cmbOppStatus" Name="inStatus" PropertyName="SelectedValue" 
                        Type="Int32" /> 
                    <asp:ControlParameter ControlID="cmbOppType" Name="inOppType" PropertyName="SelectedValue" 
                        Type="Int32" /> 
                    <asp:ControlParameter ControlID="dpWOOStartDate" Name="inStartDate" PropertyName="SelectedDate" 
                        Type="DateTime" /> 
                    <asp:ControlParameter ControlID="dpWOOEndDate" Name="inEndDate" PropertyName="SelectedDate" 
                        Type="DateTime" /> 
                    <asp:ControlParameter ControlID="cmbChannel" Name="inChannel" PropertyName="SelectedValue" 
                        Type="Int32" /> 
                    <asp:ControlParameter ControlID="cmbCampaign" Name="inCampaign" PropertyName="SelectedValue" 
                        Type="Int32" /> 
                    <asp:ControlParameter ControlID="cbNew" Name="inNew" PropertyName="Checked" Type="Boolean" /> 
                </SelectParameters> 
            </asp:ObjectDataSource> 
            <br /> 
        </telerik:RadAjaxPanel> 


        protected void Page_Load(object sender, EventArgs e) 
        { 
             
        } 
 
        protected void btnSearch_Click(object sender, EventArgs e) 
        { 
            grdSearchResults.DataBind(); 
        } 

Any help would be appreciated!!!

Regards,
Andrew
Joe
Top achievements
Rank 1
 answered on 03 Jul 2013
1 answer
29 views
I have several RadTimePicker's on my page, all sharing a RadTimeView. The popup buttom image displays fine until I add the attribute Skin="WebBlue" to the RadTimeView, then the button image disappears!

v2012.3.1308.40
Jeanne
Top achievements
Rank 1
 answered on 03 Jul 2013
2 answers
206 views
I have a radgrid. It has edit enabled only for first row.
When the edit is clicked it opens a new radwindow to collect additional information.
Also the radgrid allows row drag and drop.
On rowdrop it checks if the new position is going to be first row it opens the new window to collect similar data for the new first row.
Now when the row is edited and then if the row is dragged and droped two windows open.
If we drag one more time three windows open.
Tried a few things like 
_menuwindow.DestroyOnClose = true;
WinManager.Windows.Clear();
But doesn't help.

Please help. How can I avoid opening unneccessary windows?
If I debug the code it doesn't really go to server to open the serverside window again.
I identify the two windows by giving different names server side and client side.

Any help is appreciated.
Thanks in advance.

Here is the code :

 protected void UIProceduresGrid_ItemCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
    {
        GridDataItem gdItem = e.Item as GridDataItem;

        if (gdItem != null)
        {
            if (e.CommandName == "PDFEdit")
            {
                WinManager.Windows.Clear();
                
                RadWindow _menuwindow = new RadWindow();
                _menuwindow.NavigateUrl = "ProcedureDependantFactors.aspx";
                _menuwindow.VisibleOnPageLoad = true;
                _menuwindow.ShowContentDuringLoad = true;
                _menuwindow.Style.Value = "z-index:7010;";
                _menuwindow.ID = "ProcedureDependantFactors";                
                _menuwindow.Modal = true;
                _menuwindow.Height = 400;
                _menuwindow.Width = 900;
                _menuwindow.Title = "Procedure Dependant Factors Serverside";
                _menuwindow.DestroyOnClose = true;
               // _menuwindow.OnClientClose = "RefreshParentPage();";
                WinManager.Windows.Add(_menuwindow);
            }
        }
    }

function OnProcRowDropping(src, args) {
    //alert("Dragged grid row index is: " + args._dragedItems[0]._itemIndexHierarchical + "   Dropped target element index is: " + args._targetItemIndexHierarchical + "   Position : " + args._dropPosition);
    if (args._targetItemIndexHierarchical == 0 && args._dropPosition == 'above') {
        if (!confirm('There is another record marked as primary that record will no longer be primary. And the dependant records will be deleted. Are you sure you want to proceed?')) {
            args.set_cancel(true);
        }
        else {
            ShowPDF();
        }
    }
}

function ShowPDF() {
    var oManager = window.radopen("ProcedureDependantFactors.aspx");
    oManager.DestroyOnClose = true;
    oManager.Title = "Procedure Dependant Factors Clientside";
    oManager.set_animation(Telerik.Web.UI.WindowAnimation.Fade);
    oManager.set_behaviors(Telerik.Web.UI.WindowBehaviors.Close);
    oManager.set_visibleStatusbar(false);
    oManager.set_visibleTitlebar(true);
    oManager.set_modal(true);
    oManager.set_height("500px");
    oManager.set_width("900px");
    oManager.center();
    oManager.SetActive();
    oManager.show();
}
























































Gauri
Top achievements
Rank 1
 answered on 03 Jul 2013
1 answer
215 views
I have a web user control(NavigationControl.ascx) where I build a PanelBar and it contains another web user control.
<telerik:RadPanelBar runat="server" ID="SearchOptionsPanel" Width="172px" Skin="CMASkin" EnableEmbeddedSkins="false"
    OnClientItemClicked="PanelBarItemClicked">
    <Items>
        <telerik:RadPanelItem Text="Search Options" Expanded="true" Value="MeasureOptions">
            <Items>
                <telerik:RadPanelItem Text="">
                    <ItemTemplate>
                        <uc1:DischargeListCriteriaControl ID="DischargeListCriteriaCtrl" runat="server" />
                    </ItemTemplate>
                </telerik:RadPanelItem>
            </Items>
        </telerik:RadPanelItem>
    </Items>
</telerik:RadPanelBar>

How do I access the "DischargeListCriteriaControl" from the codebehind of the NavigationControl.ascx.cs.  The below doesn't work.
public DischargeListCriteriaControl DischargeListCriteriaControl
{
    get
    {
        return this.DischargeListCriteriaCtrl;
    }
}
Robert
Top achievements
Rank 1
 answered on 03 Jul 2013
0 answers
44 views
Hi,
I am using radpanel bar. My reqiurement is to add dyanamically a  Radgrid, and add a radgrid inside the dynamically created radpanel item.


Dhamodharan
Top achievements
Rank 1
 asked on 03 Jul 2013
1 answer
123 views
Hello,
I am trying to resize a splitter and its panes to the size of the content within the panes, and it is only partially working. I'm using 2013.1.417.40 of the Telerik.Web.UI controls.

The application scenario is a reports page, where the user can select a report from a list, tweak some report settings, and then view the report.  To this end, I have a RadComboBox/RadTreeView that allows the user to select which report to view.  Below this, I have a RadSplitter with a top pane, a splitbar, and a bottom pane.  The top pane contains a set of controls that are specific to each report.  The bottom pane is the report viewing area.  Because each report might have a different method of displaying the data, the bottom pane contains a user control that contains multiple user controls, one for each report or group of similar reports.  Within each of these lower level user controls could be a RadGrid or a charting control.

My requirements are such that there should be no scrolling within the report's grid or the  splitter panes.  All scrolling must be performed using the browser scrollbars.  Therefore, I would like to resize the splitter and the panes according to the size of the content within each pane.  For the top pane, I only have two sets of possible report controls, so I know the two possible sizes that the pane could be, and I just pass those sizes.  No problem there.  For the bottom pane, I implemented the technique described in the KB article here.  For my purpose, however, I did not want to perform the sizing in OnClientLoad, because the content is always empty until the user selects a report.  Instead, I start out with a pane height of 100px at page load.  I then size both panes when the user selects a report, and also when the data is populated in the grid or chart.

Here is some of the code.  The actual .aspx is quite large, so I've removed code that I don't think is relevant to the issue.

javascript function;

function resizeSplitter(paneControlsHeight) {
    var splitter = $find("<%= splitterMain.ClientID %>");
    if (splitter) {
        var paneControls = splitter.getPaneByIndex(0);
        var paneReportView = splitter.getPaneByIndex(1);
        if (paneControls && paneReportView) {
            paneControls.set_height(paneControlsHeight);
            paneControls.set_maxHeight(paneControlsHeight);
 
            var height = paneReportView.getContentElement().scrollHeight;
            paneReportView.set_height(height);
            var splitBar = splitter.getSplitBarByIndex(0);
            splitter.set_height(paneControlsHeight + splitBar.getHeight() + height);
        }
    }
}

ASPX markup:

<telerik:RadSplitter ID="splitterMain" runat="server" Orientation="Horizontal" Width="973">
<telerik:RadPane runat="server" id="paneControls" Width="100%" Height="250" MaxHeight="250" Scrolling="None" >
    <!-- All sorts of controls go here that allow the user to change the scope and display of their report data.
         Includes RadDatePickers, RadComboBoxes, RadTreeViews, asp:DropDownLists, etc. -->
</telerik:RadPane>
<telerik:RadSplitBar runat="server" id="splitBarMain1" CollapseMode="Forward" />
<telerik:RadPane runat="server" id="paneReportView" Width="100%" Height="100" Scrolling="None" >
    <div id="divReportView" style="width:970px; border:none;margin-top:7px; background-color:#EEEEEE; overflow:hidden;" runat="server">
        <analytics:AllReportsViewControl ID="allReportsViewControl" runat="server" ></analytics:AllReportsViewControl>
    </div>
</telerik:RadPane>
</telerik:RadSplitter>

and some relevant code in the .cs:

private void ResizeSplitterOnClient(Report report)
{
    if (report != null)
    {
        // Just determine which of two heights the top pane will get.
        int paneControlsHeight = 450;
        // ReportFilterControls.GeographyControls and ReportFilterControls.CommodityTree should be mutually exclusive, as they occupy the same real estate.
        if (report.FindFilterControl((int)ReportFilterControls.CommodityTree) != null)
        {
            paneControlsHeight = 250;
        }
        // And tell the client to call its resizeSplitter function.
        RadAjaxManager.GetCurrent(this).ResponseScripts.Add(string.Format("setTimeout('resizeSplitter({0});',100);", paneControlsHeight));
    }
}

The ResizeSplitterOnClient method is called when the user selects a new report, as well as whenever the currently active RadGrid's NeedDataSource event is fired.  This could occur when the grid is first loaded with data, or when a page-indexing or page-sizing event occurs.

When all is said and done, the dynamic sizing works fine the first time that the grid is populated.  The initial size of the bottom page is 100, and when the user triggers the data to be bound to the grid for the first time, the grid is loaded at a default of 50 rows per page.  I can see in the client that the value of the height variable in the resizeSplitter javascript function is 1337, thus setting the bottom pane and splitter height correctly.  However, when I do something that changes the grid height, such as changing the page size down to 20, height becomes 1334, and the resize leaves a whole lot of empty space between the bottom of the much-smaller grid and the bottom of the bottom pane.  If I continue further and set the page size to 10, height becomes 1331.  If I move to the last page in the data set which only contains one row, height becomes 1328.  If I go back to the first page, which contains 10 rows again, height becomes 1325.  It seems like on each postback, the number drops by 3 pixels, regardless of the actual content of the pane.

Please can somebody take a look and tell me what I'm doing wrong?
Thanks.
Steve
Top achievements
Rank 1
 answered on 03 Jul 2013
1 answer
445 views
I'm using a line chart to plot data for every M-F in a date range. I'm binding this to a datatable, and because there are a lot of dates, I'm only displaying the dates on Mondays. 

Right now the separation between every day is a major grid line and I've hidden the minor grid lines because they're irrelevant - a fraction of a day.

Is there any way to set the interval for the major/minor grid lines? Say every 5 columns is a major and every 1 day is minor?

My x axis is a collection of dates, the datetime axis didn't seem to give me enough flexibility on this so I did it manually. This means I can't use the datetime intervals. 

Here is my markup:

<telerik:RadHtmlChart runat="server" ID="RadHtmlChart1" Width="900px" Height="400px" Skin="Metro" Transitions="true" >
                <ChartTitle Text="">               
                    <Appearance Visible="false">
                        <TextStyle Margin="0" Padding="0" FontSize="1" />
                    </Appearance>
                </ChartTitle>
                <PlotArea>                                                
                    <XAxis MajorTickType="Outside" MinorTickType="None">
                        <TitleAppearance Visible="false">
                        </TitleAppearance>
                        <LabelsAppearance RotationAngle="45">
                        </LabelsAppearance>
                        <MajorGridLines Color="#EFEFEF" Width="1"></MajorGridLines>
                        <MinorGridLines Color="#F7F7F7" Width="1" Visible="false"></MinorGridLines>
                    </XAxis>
                    <YAxis>
                        <TitleAppearance Text="Price" Visible="false">
                        </TitleAppearance>
                        <MajorGridLines Color="#EFEFEF" Width="1"></MajorGridLines>
                        <MinorGridLines Color="#F7F7F7" Width="1"></MinorGridLines>
                    </YAxis>
                    <Series>
                        <rad:LineSeries MissingValues="Gap"  ColorField="Color" DataFieldY="Price">
                            <LineAppearance Width="1" />
                            <LabelsAppearance Visible="false"></LabelsAppearance>
                            <TooltipsAppearance ClientTemplate="#=dataItem.ToolTip#" />
                            <SeriesItems>
                            </SeriesItems>                           
                        </rad:LineSeries>
                    </Series>
                </PlotArea>
            </telerik:RadHtmlChart>


Danail Vasilev
Telerik team
 answered on 03 Jul 2013
1 answer
188 views
Hi,

i want to hightlight the Content of Radeditor on click of a
GridButtonColumn

i want to highlight the word which is present in grid. on GridButton Click

Nikolay
Telerik team
 answered on 03 Jul 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Ambisoft
Top achievements
Rank 2
Iron
Pascal
Top achievements
Rank 2
Iron
Matthew
Top achievements
Rank 1
Sergii
Top achievements
Rank 1
Iron
Iron
Andrey
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Ambisoft
Top achievements
Rank 2
Iron
Pascal
Top achievements
Rank 2
Iron
Matthew
Top achievements
Rank 1
Sergii
Top achievements
Rank 1
Iron
Iron
Andrey
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?