This is a migrated thread and some comments may be shown as answers.

RadGrid button Printing row

5 Answers 61 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
$uren
Top achievements
Rank 1
$uren asked on 07 Apr 2011, 12:40 PM
<MasterTableView AutoGenerateColumns="False" DataKeyNames="CustomerID">
                                <RowIndicatorColumn>
                                    <HeaderStyle Width="20px"></HeaderStyle>
                                </RowIndicatorColumn>
                                <ExpandCollapseColumn>
                                    <HeaderStyle Width="20px"></HeaderStyle>
                                </ExpandCollapseColumn>                                 
                                <CommandItemTemplate>
                               <asp:Button ID="LinkButton1" runat="server" ButtonCssClass="button" Text="Print Selected" OnClientClick="PrintRadGrid(); return false;" />         
                                </CommandItemTemplate>                              
                                <Columns>
                                    <telerik:GridBoundColumn HeaderText="Customer ID" DataField="CustomerID" UniqueName="CustomerID">
                                    </telerik:GridBoundColumn>  
                                     <telerik:GridBoundColumn HeaderText="Invoice #" DataField="InvoiceNumber" UniqueName="InvoiceNumber">
                                    </telerik:GridBoundColumn>                                  
                                    <telerik:GridBoundColumn HeaderText="Ship To Terms" DataField="ShipToTerms" UniqueName="ShipToTerms">
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn HeaderText="Ship Via" DataField="ShipVia" UniqueName="ShipVia">
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn HeaderText="OrderStatus" DataField="OrderStatus" UniqueName="OrderStatus">
                                    </telerik:GridBoundColumn>
                                    <telerik:GridButtonColumn CommandName="Print" ButtonType="PushButton" ButtonCssClass="button" UniqueName="Print" Text="Print" />                                                    
                                 </Columns>       


 protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
    {
        if (e.CommandName == "Print")
        {
            CODE
        }
}

I want to Print the row data when i click the button

 can anyone help with this code it..............

Thanks in advance
Suren

5 Answers, 1 is accepted

Sort by
0
illumination
Top achievements
Rank 2
answered on 13 Jul 2011, 06:52 PM
Did anybody solve this problem?
0
Shinu
Top achievements
Rank 1
answered on 14 Jul 2011, 10:11 AM
Hello,

You can follow the the following code library approach to achieve your requirement.
Print RadGrid contents.

Thanks,
Shinu.
0
illumination
Top achievements
Rank 2
answered on 14 Jul 2011, 01:55 PM
Hi,
You guys keep giving samples that print the WHOLE grid. I just want the selected row printed using commandname:

<telerik:GridButtonColumn ButtonType="LinkButton" CommandName="Print" Text="Print" UniqueName="PrintColumn" > 

 

<HeaderStyle Width="20px" />

 

<ItemStyle HorizontalAlign="Center" />

 

</telerik:GridButtonColumn>

Any other suggestion?
Thanks.
0
EZNet Support
Top achievements
Rank 1
answered on 12 Oct 2012, 03:11 PM
Did you ever get a resolution to this post? I have the same scenario.
0
Daniel
Telerik team
answered on 17 Oct 2012, 02:42 PM
Hello,

If you examine the contents of the code-library you will notice that it relies on very simple javascript code to print the HTML output of the control together with the CSS styles. That said, you can remove/hide the unwanted parts of this HTML and print whatever part is suitable for your scenario.
The htmlContent variable contains all the HTML code. Alternatively you can find the desired data item using our API and put only this row's HTML in the htmlContent variable.
By the way, the print-radgrid-skins-dll.zip is the latest version of this code-library.
I hope this helps.

Best regards,
Daniel
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
General Discussions
Asked by
$uren
Top achievements
Rank 1
Answers by
illumination
Top achievements
Rank 2
Shinu
Top achievements
Rank 1
EZNet Support
Top achievements
Rank 1
Daniel
Telerik team
Share this question
or