0

I want to create n numbers of dynamic link buttons runtime.
I will have an xml file which has the format like

<category>
<link>
Link1
</link>
<pdf>
PDF1
</pdf>
</category>
<category>
<link>
Link2
</link>
<pdf>
PDF2
</pdf>
</category>
<category>
<link>
Link3
</link>
<pdf>
PDF3
</pdf>
</category>
........
........
........
and so on

I have to take the element within the <Link> tag and make it as a linkbutton and when user will click the button, it will open a pdf file named within the <pdf> tag.
It may happen that the xml has 10 such tags, it may have 200 tags, based on the number of such tags, our link buttons will be created and pdf files will be opened on clicking the respective linkbuttons. How can I achieve this?

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by stbuchok
0

Loop through the items in the xml. For each of the categories, get the link and the pdf and make a link button.

Hope this helps (I don't have time to write the actual code)

//this is not the actual code.
foreach(...)
{
    LinkButton link = new LinkButton();

    link.URL = pdf;
    link.Text = link

    //panel should be any kind of server side control that you can add other controls to
    panel.child.add(link);
}
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.