Click here to Skip to main content
15,897,891 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have binded bound some data in Repeater control from SqlServer 2005; now the issue is, in Repeater control I have CheckBox ,whatever items which are selected from the repeater should be converted into PDF file, the detail thing is in Repeater I randomly select items, and when I click the PDF button it should be converted into PDF; whatever Alignment applied in aspx page, the same Alignment should be applied to PDF too
Please help me.
Thanks in advance.
Posted
Updated 25-Apr-12 15:21pm
v2
Comments
[no name] 25-Apr-12 10:46am    
Which part are you having difficulty with? What have you tried so far?
Member 8405530 25-Apr-12 23:29pm    
i dont know how to apply the logic for checkbox...guide me with some ideas....i have bound the data in repeater and entire items which are in the repeatercontrol will be converted into PDF...but i want only selected items from the checkbox to be converted into PDF..Please help me as soon as possible.

For determining whether the Checkboxes are checked, you need to look for the control first by using FindControl[^] method of the repeater item.

Suppose this is your repeater and Button2 is your export to PDF button:

XML
<asp:Button ID="Button2" runat="server" onclick="Button2_Click" /><br />
    <asp:Repeater ID="Repeater1" runat="server" OnItemCommand="Repeater1_ItemCommand">
    <ItemTemplate>
            <asp:CheckBox ID="Checkbox1" runat="server" />
            <asp:Label ID="Label2" runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "Name")%>' />
            <br />
    </ItemTemplate>
    </asp:Repeater>


You can accomplish your goal by implementing something similar to the one below.

C#
protected void Button2_Click(object sender, EventArgs e)
{
    foreach (RepeaterItem item in Repeater1.Items)
    {
        if (((CheckBox)item.FindControl("Checkbox1")).Checked)
        {
            //Do something
        }
    }
}


Now that can filter checked items, you can use some third party API like ITextSharp[^] to export data to PDF. Here[^] is a good tutorial for starters about the API.
 
Share this answer
 
<b>jitendra Negi </b> hello <a href=""></a>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900