none
Redirecting to a link from a custom list using sharepoint 2010

    Question

  • I have created a custom list named links with columns campus,degree,type,link icon,Social link.

    Type is of field  choice which contain options alberts,campus,degree.

    Here,campus and degree are of managed metadata fields.link icon is picture.Link is the hyperlink.

    I have created a custom web part and using html  i created a box with alberts,degree and campus as the contents in the box.

    I have created a expand and collapse button for these three contents.

    When i click on 'campus', fetch the link icon for example 'facebook' icon and the social link of 'facebook'  from the custom list. Then popup that social link  in a new window.... 

    What i think is that I need to use caml query and repeater controls in my custom webpart.

    How can i achieve it?

    Can anyone give the code for my requirement?

    Any help would be highly appreciated.




    Saturday, March 03, 2012 5:20 PM

Answers

  • SPList l = w.Lists["yourlistname"];
                SPView view = l.DefaultView;
                SPQuery query = new SPQuery();
                query.ViewFields = string.Concat("<FieldRef Name='linkIcon'/>""<FieldRef Name='LinkURL'/>"");
     
                query.ViewFieldsOnly = true;
                query.Query="<where><And><FieldRef Name=\"Type\"/></Value type=\"column type\">MyDegree</Value><FieldRef Name=\"SchoolOf\"/></Value type=\"column type\">school type</Value></And></Where>";

    Monday, March 05, 2012 5:33 AM

All replies

  • you can use caml builder to generate query to extract information from links list. You can download utility from here

    http://www.u2u.net/Tools/wincamlquerybuilder/CamlQueryBuilder.aspx


    Regards,
    Milan Chauhan

    Saturday, March 03, 2012 6:51 PM
  • Thanks.

    How to redirect the social link to a new window ?

    Is it possible to fetch multiple values from a list as I want to fecth the link icon as well as link url.
    Sunday, March 04, 2012 6:15 AM
  • When clicked on icon pic,It should redirect to icon link.Both icon pic and icon link are columns in a custom list as  i mentioned earlier.

    How to write code for it?

    Sunday, March 04, 2012 7:13 AM
  • Hi,

            i understood that you are using HTML tag to bind your data .if you use HTML tag ,It is very easy to achieve .

    e.g :<a href="your picture link column value" target="_blank"><img src="Picture icon column value"/></a>

    the use of target="_blank" property is that it will open a new window to show your requesting url.

    Monday, March 05, 2012 5:07 AM
  • Thanks..

    select linkIcon, LinkURL
    FROm LIstName
    Where Type= "MyDegree"
    AND SchoolOf= user profile school of.

    I want to use this in my code.

    How to wite this In caml query?


    Monday, March 05, 2012 5:27 AM
  • SPList l = w.Lists["yourlistname"];
                SPView view = l.DefaultView;
                SPQuery query = new SPQuery();
                query.ViewFields = string.Concat("<FieldRef Name='linkIcon'/>""<FieldRef Name='LinkURL'/>"");
     
                query.ViewFieldsOnly = true;
                query.Query="<where><And><FieldRef Name=\"Type\"/></Value type=\"column type\">MyDegree</Value><FieldRef Name=\"SchoolOf\"/></Value type=\"column type\">school type</Value></And></Where>";

    Monday, March 05, 2012 5:33 AM
  •  Thanks a lot..
    Monday, March 05, 2012 5:37 AM