SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Member
    Join Date
    Dec 2007
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Repeater Help For Beginner Developer

    Hi,

    I've read the tutorial on repeater controls which was quite useful at: http://www.sitepoint.com/article/asp...peater-control

    However I have displayed the field from my web service and this appears on screen as: DOC~HTML~PDF
    I now need to write some c# code logic which display the relevant icon for each of the above e.g. doc-icon.gif, html-icon.gif and pdf-icon.gif. The result could be all 3 or just 1.
    I was going to put the icons in a imagebutton which would then open up a specific view depending on which icon is selected.

    Can anyone help with the above, ideally some code to get me started?

    Thanks in advance,
    puthsardarade

  2. #2
    SitePoint Member
    Join Date
    Dec 2007
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    Can no-one help with this?

    Thanks

  3. #3
    SitePoint Wizard
    Join Date
    Feb 2007
    Posts
    1,274
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Put the icons inside asp:hyperlinks in the item template. Make sure the hyperlinks are server-side controls and that they have IDs.

    Implement an ItemDataBound event handler (it fires for every item) to set the visibility of each local hyperlink based on the data item. You will need to find the hyperlink using the FindControl method.

    Sorry, can't post code, but googling these terms should get you started.

  4. #4
    SitePoint Member
    Join Date
    Dec 2007
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks to sbakshi on another forum I managed to resolve this.

    aspx page:

    <asp:Repeater ID="rplist" OnItemDataBound="rplist_OnBound" runat="server">
    <ItemTemplate>
    <asp:HiddenField runat="Server" Id="hidImages" Value ='<%# Eval("recordTypes")%>' />
    <asp:ImageButton runat="Server" ID="imgDoc" ImageUrl="/img/word-icon.gif" OnClick="imgDoc_Click" /> <asp:ImageButton runat="Server" ID="imgPDF" ImageUrl="/img/pdf-icon.gif" OnClick="imgPDF_Click" /> <asp:ImageButton runat="Server" ID="imgHTML" ImageUrl="/img/html-icon.gif" OnClick="imgHTML_Click" />
    </ItemTemplate>
    </asp:Repeater>



    cs page:

    As below + click events for each images:

    protected void imgPDF_Click(object sender, EventArgs e)
    {

    }



    If you feel the above can be further improved then please let me know.


    There was just one more thing which I would appericate some help on.


    I would like to show some html on screen for one of my views. The html is retrieved from the output2 in my try statement below, however I need to strip out all html tags, such as <html> </html>, <body>, </body> etc and display all this in a literal string?


    Any help on this would be appericated?

    Thanks

    code:

    LBService.LBServiceService lb = new LBService.LBServiceService();

    LBService.SystemRecordInput input2 = new LBService.SystemRecordInput();
    LBService.SystemRecordOutput output2 = null;
    LBService.SystemRecordIdentifiers data = new LBService.SystemRecordIdentifiers();

    data.recordType = "HTML";
    data.systemId = "1";

    input2.standardInput = x;
    input2.serviceInput = data;


    try
    {
    output2 = lb.loadSystemRecord(input2);
    lit1.Text += output2.serviceOutput.textData;

    }

  5. #5
    SitePoint Addict
    Join Date
    Feb 2005
    Location
    Clogland
    Posts
    322
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This should help you with stripping HTML from a string:

    http://weblogs.asp.net/rosherove/arc...5/13/6963.aspx


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •