Telerik Forums
UI for ASP.NET AJAX Forum
5 answers
560 views
I'm having trouble writing a pdf file to the browser when a user clicks a linkbutton inside a radgrid detailview gridtableview gridtemplatecolumn.  The grid is also wrapped in an update panel. The click event fires and the bytes are written to the response without error.  However the browser's file download dialog never appears.

Any insights would be greatly appreciated.

<asp:UpdatePanel ID="updatePanel" ClientIDMode="Static" runat="server">
            <ContentTemplate>
    <telerik:RadGrid ID="rgDocuments" runat="server" Width="100%" ShowStatusBar="False" AutoGenerateColumns="False"
        AllowSorting="False" AllowMultiRowSelection="False" AllowPaging="False" Skin="EACS" EnableEmbeddedSkins="false"
        OnDetailTableDataBind="rgDocuments_DetailTableDataBind" OnNeedDataSource="rgDocuments_NeedDataSource"
        OnPreRender="rgDocuments_PreRender">
        <MasterTableView Width="100%" DataKeyNames="DOCUMENT_AUTHOR_ID" AllowMultiColumnSorting="True">
            <DetailTables>
                <telerik:GridTableView DataKeyNames="DOCUMENT_AUTHOR_ID,DOCUMENT_AUTHOR_CATEGORY_ID" Name="Categories" Width="100%" >
                    <DetailTables>
                        <telerik:GridTableView DataKeyNames="DOCUMENT_ID,PARENT_DOCUMENT_ID" Name="ParentDocuments" Width="100%">
                            <DetailTables>
                                <telerik:GridTableView DataKeyNames="DOCUMENT_ID,FILENAME,TITLE" Name="Documents" Width="100%">                           
                                    <Columns>
                                        <telerik:GridBoundColumn DataField="DOCUMENT_ID" Visible="false">
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="FILENAME" Visible="false">
                                        </telerik:GridBoundColumn>
                                        <telerik:GridTemplateColumn HeaderText="Section Title">
                                            <ItemTemplate>
                                                   <asp:LinkButton ID="btnDocument" runat="server" OnClick="btnDocument_Click" Text='<%# Eval("Title") %>'></asp:LinkButton>
                                              </ItemTemplate>
                                        </telerik:GridTemplateColumn>
                                    </Columns>
                                </telerik:GridTableView>
                            </DetailTables>
                            <Columns>
                                <telerik:GridBoundColumn DataField="DOCUMENT_ID" Visible="false">
                                </telerik:GridBoundColumn>                               
                                <telerik:GridBoundColumn HeaderText="Document Title" DataField="TITLE" >
                                </telerik:GridBoundColumn>
                            </Columns>
                        </telerik:GridTableView>
                    </DetailTables>
                    <Columns>
                        <telerik:GridBoundColumn DataField="DOCUMENT_AUTHOR_CATEGORY_ID" Display="false">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn HeaderText="Category" DataField="DISPLAY_VALUE">
                        </telerik:GridBoundColumn>
                    </Columns>
                </telerik:GridTableView>
            </DetailTables>
            <Columns>
                <telerik:GridBoundColumn DataField="DOCUMENT_AUTHOR_ID" Visible="false"></telerik:GridBoundColumn>
                <telerik:GridBoundColumn HeaderText="Author Name" DataField="DISPLAY_VALUE"></telerik:GridBoundColumn>
            </Columns>
        </MasterTableView>
    </telerik:RadGrid>
    </ContentTemplate>
    </asp:UpdatePanel>

protected void btnDocument_Click(object sender, EventArgs e)
        {
            LinkButton lb = (LinkButton)sender;
            GridDataItem item = (GridDataItem)lb.NamingContainer;
            if (item != null)
            {
                string documentUploadPath = ConfigurationManager.AppSettings["DocumentUploadPath"].ToString();               
                string filename = documentUploadPath + item.GetDataKeyValue("FILENAME").ToString();
                string title = documentUploadPath + item.GetDataKeyValue("TITLE").ToString();
 
                if (File.Exists(Server.MapPath(filename)))
                {
                    System.Web.HttpResponse response = System.Web.HttpContext.Current.Response;
 
                    byte[] bytes = File.ReadAllBytes(Server.MapPath(filename));
 
                    response.Clear();
                    response.AddHeader("Content-Type", "binary/octet-stream");
                    response.AddHeader("Content-Disposition",
                        "attachment; filename=" + title + ".pdf;");
                    response.Flush();
                    response.BinaryWrite(bytes);
                    response.Flush();
                    response.End();
                }
            }
        }

Stephen
Top achievements
Rank 1
 answered on 30 Apr 2014
1 answer
172 views
Hi, I am using 2013 Q3 version.  I have a problem as follows:

In client side, I have defined RadGrid and the corresponding ClientSettings as follows:
<telerik:RadGrid runat="server" ID="OrgGrid" AutoGenerateColumns="False" AllowSorting="True" AllowFilteringByColumn="True"
                         AllowPaging="True" AllowCustomPaging="true" CellSpacing="0" EnableLinqExpressions="false"
                         EnableViewState="true" ShowGroupPanel="True">
            <ClientSettings AllowColumnsReorder="true" AllowDragToGroup="true" ReorderColumnsOnClient="true">
                <Resizing AllowColumnResize="true" AllowRowResize="false" ResizeGridOnColumnResize="true" />
                <ClientEvents OnColumnResized="OnColumnResized" />
            </ClientSettings>
      ....

I would like to know the way to set the textbox width in the FilteringItem in OnColumnResized event.  I tried the following but it doesn't return anything to me in the textbox.
            function OnColumnResized(sender, eventArgs) {
                var _OrgGrid = $find("<%= OrgGrid.ClientID %>");
                var _MasterTableView = _OrgGrid.get_masterTableView();
                var _filterRow = $telerik.$(_OrgGrid.get_element()).find("rgFilterRow");
                var _textbox = $telerik.findElement(_filterRow[0], "OrgCode");
                _textbox.width = eventArgs.get_gridColumn().get_element().offsetWidth - 40;

                return false;
            }  

Thanks.
Emily



Princy
Top achievements
Rank 2
 answered on 30 Apr 2014
7 answers
1.0K+ views
Hi!

I'm trying to validate the content of a Prometheus ComboBox. But I'm facing a "small" problem. This is what I have:

- A RadComboBox;
- A RequiredFieldValidator (validating the combo)
- A button

When I press the button, it postbacks to the server, and after that, it shows the warning message saying that the field is not filled.

Shouldn't the validator validate the page on the Client? Please tell me that I'm missing something... Do I have to set any other properties on the combox to get this to work?

Thanks!
Princy
Top achievements
Rank 2
 answered on 30 Apr 2014
7 answers
429 views
Hi,

When a textbox is in an updatepanel, and trying to enter large content, the following error occurs:

System.ArgumentException: Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property.
Parameter name: input
   at System.Web.Script.Serialization.JavaScriptSerializer.Deserialize(JavaScriptSerializer serializer, String input, Type type, Int32 depthLimit)
   at Telerik.Web.UI.RadInputControl.LoadPostData(String postDataKey, NameValueCollection postCollection)
   at System.Web.UI.Page.ProcessPostData(NameValueCollection postData, Boolean fBeforeLoad)
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

Regard
Andreas
Angel Petrov
Telerik team
 answered on 30 Apr 2014
4 answers
210 views
i want to get Group Header Text in Radgrid OnGroupCollapsing Event...i got header text in  server side event but i want in client side .so please help me.
Eyup
Telerik team
 answered on 30 Apr 2014
5 answers
336 views
Hi,

Does Telerik have anything similar to what DevExpress have on Custom Validation Summary Control. I am basically looking to have Hyperlinks on the Errors been displayed on the Validation Summary some of my forms are so long basically the user clicks on the hyperlink and puts a focus on the input field.

Please let me know

Thanks
Viktor Tachev
Telerik team
 answered on 30 Apr 2014
3 answers
200 views
Please add DropDownAutoWidth into your discovery online demo http://demos.telerik.com/aspnet-ajax/combobox/examples/configurator/defaultcs.aspx
Aneliya Petkova
Telerik team
 answered on 30 Apr 2014
30 answers
1.0K+ views
Is it possible to set the StartTime and EndTime of a radTimePicker's TimeView within client-side JavaScript?
pierreluigi88
Top achievements
Rank 1
 answered on 30 Apr 2014
1 answer
91 views
How do i force this control to shows up 24:00 instead of 00:00

I am aware that it's not a regular time but anyway i want it to has 24:00 instead of 00:00 .. meaning after 23:00 should follow 24:00 ...

I am using format HH:mm and Culture fr-FR 

Thank you so much
Shinu
Top achievements
Rank 2
 answered on 30 Apr 2014
5 answers
464 views
Hi,

I am trying to use Serverside ExporttoExcel() function which when executed the page doesnot complete the postback.

The download completes but the page is not completing the page lifecycle.

I have Export to Excel in a dropdownList.When that is selected the save/cancel window comes up. Even when i do either of them the dropdown would still remain on export to excel.

Any help in this matter would be appreciated.

Thanks,
Ashwini
Princy
Top achievements
Rank 2
 answered on 30 Apr 2014
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?