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

Hi,

      My requirement is to generate PDF while clicking on image button in the grid.In the same page I have one search button(btnSearch). I have implemented OnNeedDataSource event.While clicking on search button I want to rebind the radgrid but I am getting this error “ErrorDetails : System.ArgumentException: Cannot unregister UpdatePanel with ID 'upnlPdf' since it was not registered with the ScriptManager. This might occur if the UpdatePanel was removed from the control tree and later added again, which is not supported. Parameter name: updatePanel at System.Web.UI.PageRequestManager.UnregisterUpdatePanel(UpdatePanel updatePanel) at System.Web.UI.ScriptManager.System.Web.UI.IScriptManagerInternal.UnregisterUpdatePanel(UpdatePanel updatePanel) at System.Web.UI.UpdatePanel.OnUnload(EventArgs e) at System.Web.UI.Control.UnloadRecursive(Boolean dispose) at System.Web.UI.Control.UnloadRecursive(Boolean dispose) at System.Web.UI.Control.UnloadRecursive(Boolean dispose) at System.Web.UI.Control.UnloadRecursive(Boolean dispose) at System.Web.UI.Control.RemovedControl(Control control) at System.Web.UI.ControlCollection.RemoveAt(Int32 index) at System.Web.UI.ControlCollection.Clear() at System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data) at System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data) at System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) at System.Web.UI.WebControls.DataBoundControl.PerformSelect() at Telerik.Web.UI.GridTableView.PerformSelect() at System.Web.UI.WebControls.BaseDataBoundControl.DataBind() at Telerik.Web.UI.GridTableView.DataBind() at Telerik.Web.UI.RadGrid.DataBind() at Telerik.Web.UI.RadGrid.AutoDataBind(GridRebindReason rebindReason) at Telerik.Web.UI.RadGrid.Rebind() at btnSearch_Click(Object sender, EventArgs e)”.

In aspx Page

===================================================================

<%@ Page Language="C#" MasterPageFile="~/ATMaster.Master" AutoEventWireup="true">

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

    <asp:UpdatePanel runat="server" ID="upnlSecurityDoc" UpdateMode="Conditional">

        <ContentTemplate>

<telerik:RadGrid ID="RadGrid1" runat="server" Width="1050px" TabIndex="5" Height="350px"

                                        AutoGenerateColumns="False" ForeColor="#333333" PageSize="10" AllowFilteringByColumn="false"

                                        Skin="Outlook" AllowPaging="true" OnNeedDataSource=" RadGrid1_NeedDataSource"

                                        BorderWidth="1px" BorderColor="#cccccc" OnItemCommand=" RadGrid1_ItemCommand"

                                        >

                                        <HeaderContextMenu EnableAutoScroll="True">

                                        </HeaderContextMenu>

                                        <GroupingSettings CaseSensitive="false" />

                                        <MasterTableView PagerStyle-AlwaysVisible="true">

                                            <CommandItemSettings ExportToPdfText="Export to Pdf" />

                                            <Columns>

                                                <telerik:GridTemplateColumn HeaderText="SlNo" AllowFiltering="false">

                                                    <HeaderStyle HorizontalAlign="Left" Font-Bold="true" Width="50px" />

                                                    <ItemStyle HorizontalAlign="Left" Width="50px"></ItemStyle>

                                                    <ItemTemplate>

                                                        <%# this.gvPendingOrder.CurrentPageIndex * this.gvPendingOrder.PageSize + Container.ItemIndex + 1%>

                                                    </ItemTemplate>

                                                </telerik:GridTemplateColumn>

                                               

<telerik:GridTemplateColumn HeaderText="PDF">

                                                    <HeaderStyle Width="50px" />

                                                    <ItemStyle Width="50px" />

                                                    <ItemTemplate>

                                                        <asp:UpdatePanel runat="server" ID="upnlPdf">

                                                            <ContentTemplate>

                                                                <asp:ImageButton runat="server" ID="imgbtnPdf" AlternateText="Security Document Print"

                                                                    CommandArgument='<%# Eval("OrderId") %>' ImageUrl="../Images/pdf_icon.gif" ImageAlign="Middle"

                                                                    CommandName="Generate" ToolTip='<%# "Document" + Eval("OrderNo") + "." %>' />

                                                            </ContentTemplate>

                                                            <Triggers>

                                                                <asp:PostBackTrigger ControlID="imgbtnPdf" />                                                            </Triggers>

                                                        </asp:UpdatePanel>

                                                    </ItemTemplate>

                                                </telerik:GridTemplateColumn>

                                            </Columns>

                                        </MasterTableView>

                                        <ClientSettings EnableRowHoverStyle="true">

                                            <Scrolling AllowScroll="True" UseStaticHeaders="True" SaveScrollPosition="True">

                                            </Scrolling>

                                        </ClientSettings>

                                    </telerik:RadGrid>

</ContentTemplate>

    </asp:UpdatePanel>

</asp:Content>

In code behind

protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e)

        {

            try

            {

                if (e.CommandName == "Generate")

                {

                    string strOrderId = string.Empty;

                    strOrderId = e.CommandArgument.ToString();

                    LocalReport localReport = new LocalReport();

                localReport.ReportPath = Server.MapPath("~/Reports/report1.rdlc");

                localReport.EnableHyperlinks = true;

                localReport.EnableExternalImages = true;

                DataSet dataset1 = new DataSet();

                DataTable datatable1 =GetDetails(strOrderId);

                datatable1.TableName = "Document";

                dataset1.Tables.Add(datatable1.Copy());

                ReportParameter[] @params = new ReportParameter[4];

                localReport.SetParameters(@params);

                //A method that returns a collection for our report Note: A report can have multiple data sources

                localReport.DataSources.Add(new ReportDataSource("dataset", dataset1.Tables[0]));

                string reportType = "pdf";

                string mimeType = string.Empty;

                string encoding = string.Empty;

                string fileNameExtension = string.Empty;

                string deviceInfo = "<DeviceInfo>" + " <OutputFormat>pdf</OutputFormat>" + "</DeviceInfo>";

                Warning[] warnings = null;

                string[] streams = null;

                byte[] renderedBytes = null;

                //Render the report

                renderedBytes = localReport.Render(reportType, deviceInfo, out mimeType, out encoding, out fileNameExtension, out streams, out warnings);

                //Clear the response stream and write the bytes to the outputstream

                //Set content-disposition to "attachment" so that user is prompted to take an action on the file (open or save)

                Response.Clear();

                Response.ContentType = mimeType;

                strOrderId = "Doc" + strOrderId;

                Response.AddHeader("content-disposition", ("attachment; filename=" + strOrderId + ".pdf"));

                Response.BinaryWrite(renderedBytes);

                Response.End();                }

            }

            catch (Exception ex)

            {

                lblMessage.Text = objUtl.GetErrorMessage(ex, this);

                lblMessage.Visible = true;

            }

        }

Daniel
Telerik team
 answered on 02 Aug 2011
1 answer
99 views
Hi,
I am using fully clickable telerik rad chart in my application...
I can drill down up to 3 levels in chart. When clicking on the bar on main chart, a grid will be displayed and in the grid we have given links to another pages...
Now here the issue is, when value of one bar is too small as compared to another then the bar with too small values is not clickable so I'm unable to drill down to that bar...
I guess this is technical limitation of the control when one bar is having higher values(say in lacs) as compared to another...
So, is there any solution or work around for this??

Thanks in advance...
Vladimir Milev
Telerik team
 answered on 02 Aug 2011
11 answers
360 views
Hi,

I have a few  questions with regards to filtering in RadGrid.
1)
Is there anyway for me to set these filtering settings by default so that I dun have to type this for every columns?
  <telerik:GridBoundColumn DataField="FieldName" HeaderText="1st WS" HeaderStyle-Width="20px"
                    HeaderTooltip="Something" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains">

2) When I use CurrentFilterFunction="Contains", how I specify case insensitive matching?

3) Is there anyway to apply the filter without a flicker on the page due to AutoPostBackOnFilter="true" ?


Thanks
Jayesh Goyani
Top achievements
Rank 2
 answered on 02 Aug 2011
8 answers
258 views
Remove 'Add New Record' command bar color in Telerik Grid

hi ,

i am using a TeleriK grid - Skin = Vista
i have a command bar for adding more records - "Add New Record"
All the functionality is working fine...

My issue is related to look and feel

I want the same look of Grid Headder for the command bar

i want command bar color alos in light blue, as the same of Grid headder
Dilip
Top achievements
Rank 1
 answered on 02 Aug 2011
3 answers
326 views
Hi,

  1. Can we customize the Add/Edit Appointments popup with some additional controls like listbox, fileupload etc.?

  2. How to manage snooze and dismiss/dismiss All buttons of Reminder Popup?

    Actual problem is, even if we have dismiss the reminder it will alert, so how to handle it.

     

Find the Attachment of Appointment Add/Edit Popup we requires - is it possible to create?.

Plamen
Telerik team
 answered on 02 Aug 2011
2 answers
90 views
Hi,

I have a GridTemplateColumn that contains an IMG. I have JS code that runs whenever the client side OnRowClick event is fired. This code works fine except for when I click on the IMG.

My grid definition
<telerik:RadGrid ID="grdTicket" runat="server" AutoGenerateColumns="False" Width="946px"
    Font-Names="Verdana" Font-Size="X-Small" AllowSorting="True"
    AllowPaging="True" OnNeedDataSource="grdTicket_NeedDataSource"
    OnPreRender="grdTicket_PreRender"
    OnSelectedIndexChanged="grdTicket_SelectedIndexChanged" CellSpacing="0"
    GridLines="None">
    <ClientSettings>
        <ClientEvents OnRowClick="handleRowClick" />
        <Selecting AllowRowSelect="True" />
    </ClientSettings>
    <MasterTableView Width="100%" NoDetailRecordsText="No Records To Display">
        <Columns>
            <telerik:GridBoundColumn HeaderText="User ID" DataField="UserId" UniqueName="UserID">
            </telerik:GridBoundColumn>
            <telerik:GridTemplateColumn UniqueName="ReplyColumn" AllowFiltering="false">
                <ItemTemplate>
                    <img alt="reply" src="ico_reply_green.png" title="Reply"/>
                </ItemTemplate>
            </telerik:GridTemplateColumn>
        </Columns>
    </MasterTableView>
    <PagerStyle Mode="NextPrevNumericAndAdvanced" ShowPagerText="true" />
</telerik:RadGrid>

My JS
<script type="text/javascript">
    function getHeaderRow(sender) {
        var masterTable = sender.get_masterTableView();
        return masterTable.HeaderRow == null ? sender.get_masterTableViewHeader().get_element() : masterTable.HeaderRow;
    }
 
    function handleRowClick(sender, args) {
        var masterTable = sender.get_masterTableView();
        var cellIndex = args.get_domEvent().target.cellIndex;
        var cellText = args.get_domEvent().target.innerHTML;
        var colName = masterTable.getColumnUniqueNameByCellIndex(getHeaderRow(sender), cellIndex)
        alert("Unique name: " + colName + "\nText: " + cellText);
    
</script>

My code behind
protected void grdTicket_NeedDataSource(object source, GridNeedDataSourceEventArgs e)
{
    DataSet ds = new DataSet();
    DataTable dt = new DataTable();
    dt.Columns.Add("UserId");
 
    for (int i = 0; i < 15; i++)
    {
        DataRow dr = dt.NewRow();
        dr["UserId"] = "XYZ" + i.ToString();
        dt.Rows.Add(dr);
    }
 
    ds.Tables.Add(dt);
    grdTicket.DataSource = ds;
}

What do I need to do to get the OnRowClick event to fire when I click on the IMG?  I'd like to do this without resorting to server side code.

Thanks,

David
Mark
Top achievements
Rank 1
 answered on 02 Aug 2011
1 answer
136 views
Hi
Please look at the following errors

we are unable to access any of the controls at development time.

Please reply  ASAP.

Message: Invalid character
Line: 1
Char: 1
Code: 0
URI: http://aspnet-scripts.telerikstatic.com/ajaxz/2010.3.1317/ComboBox/RadComboBoxScripts.js




Message: Invalid character
Line: 1
Char: 1
Code: 0
URI: http://aspnet-scripts.telerikstatic.com/ajaxz/2010.3.1317/Calendar/RadDatePicker.js




Message: Invalid character
Line: 1
Char: 1
Code: 0
URI: http://aspnet-scripts.telerikstatic.com/ajaxz/2010.3.1317/Input/TextBox/RadInputScript.js




Message: Invalid character
Line: 1
Char: 1
Code: 0
URI: http://aspnet-scripts.telerikstatic.com/ajaxz/2010.3.1317/Input/DateInput/RadDateInputScript.js




Message: Invalid character
Line: 1
Char: 1
Code: 0
URI: http://aspnet-scripts.telerikstatic.com/ajaxz/2010.3.1317/Calendar/RadTimeViewScripts.js




Message: Invalid character
Line: 1
Char: 1
Code: 0
URI: http://aspnet-scripts.telerikstatic.com/ajaxz/2010.3.1317/Calendar/RadDateTimePickerScript.js




Message: Invalid character
Line: 1
Char: 1
Code: 0
URI: http://aspnet-scripts.telerikstatic.com/ajaxz/2010.3.1317/Scheduler/RecurrenceRule/RecurrenceRule.js




Message: Invalid character
Line: 1
Char: 1
Code: 0
URI: http://aspnet-scripts.telerikstatic.com/ajaxz/2010.3.1317/Scheduler/RecurrenceEditor/RecurrenceEditor.js




Message: Invalid character
Line: 1
Char: 1
Code: 0
URI: http://aspnet-scripts.telerikstatic.com/ajaxz/2010.3.1317/Input/NumericTextBox/RadNumericInputScript.js
Helen
Telerik team
 answered on 02 Aug 2011
6 answers
213 views
Ok, I know how to set all rows into Edit mode.

I know how to do the batch update (with UpdateAll).

I know how to set the entire grid into Edit mode initially.

BUT, what I can't figure out, is how to set any number of user-selected rows into Edit mode.  I can only surmise that they must be set into Edit mode via an external button and not via the Edit command for any of the rows currently selected?

Jerry
jofy
Top achievements
Rank 1
 answered on 02 Aug 2011
2 answers
137 views
Hi,

I got this error because I have RadAjaxManager in both the Site.Master and the Default.aspx page.
[InvalidOperationException: Only one instance of a RadAjaxManager can be added to the page!]

My question is where is the best place to place the RadAjaxManager if I need to ajaxify controls in both Site.Master and Default.aspx?


The 2nd question is how do I display a spinning flower/circle/icon when the control is loading?
STEVEN
Top achievements
Rank 1
 answered on 02 Aug 2011
10 answers
443 views
hi!

I have rad grid inside the scheduler advanced edit/insert form. I declared an event on row clicked for grid but i receive javascript error ( it can not find the function).

Thanks for help
Radek
Peter
Telerik team
 answered on 02 Aug 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?