Create Custom List, store information and display the information on web part

Hi,
Working on a Custom visual web part in sharepoint 2010. Scenario is i would like to have two button on that web part, one is "I read it " button for users to tag the page and another one is "find the list of people who already tag/read that
page". i have added a visual web part into my project and two buttons event within it. Now goal is once user click on "I read it button" it will create custom list to store urls and usersname. When click on "Find the list of people"
get the username only for that specific page whoever read/tag it.
1. How can i create the custom list to store all users information
2. Retrieve the information from Custom List and Display the list of people based on specific page url who ever read/tag that page. 
Any help will be greatly appreciated!

Appreciated for your help!
List has four columns Title, Hyperlink, Created by, and created. i just wanted to display Users and hyperlink column. i tried to retrieve the items from list but query is not returning any items and displaying. As you said in CAML query we can pass the page
url to get the collection of user for that particular page. but is not something will be hard coded value, if we pass the page url into CAML query? is there something we can dynamically retrieve the users based on page url.  for example, if users visits
30 different page url, i need to put all those urls into CAML Query. do i need to create custom user field or i can use Created by field to get the users? please correct me if i am wrong. Below is the code:
using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;
using System.Data;
namespace CustomUserControl.VisualWebPart1
    public partial class VisualWebPart1UserControl : UserControl
        protected void Page_Load(object sender, EventArgs e)
        protected void btnRead_Click(object sender, EventArgs e)
            using (SPSite site = new SPSite(SPContext.Current.Web.Site.ID))
                using (SPWeb web = site.OpenWeb())
                    web.AllowUnsafeUpdates = true;
                    SPList list = web.Lists["UserInformation"];
                    SPListItem newItem = list.Items.Add();
                    SPFieldUrlValue hyper = new SPFieldUrlValue();
                    //hyper.Description = "Google";
                    hyper.Url = System.Web.HttpContext.Current.Request.Url.AbsoluteUri.ToString();
                    newItem["Hyperlink"] = hyper;
                    newItem.Update();
                    web.AllowUnsafeUpdates = false;
        protected void btnDisplay_Click(object sender, EventArgs e)
            SPWeb web = SPContext.Current.Web;
            SPList list = web.Lists["UserInformation"];
            SPQuery query = new SPQuery ();           
            query.Query = "<Where><Eq><FieldRef Name='Hyperlink' Type='URL' /><Value>http://nyc01d1sptmp01:8080/diligent/wiki/cft/Pages/home.aspx</Value></Eq></Where>";
            DataGrid grdList = new DataGrid();
            SPListItemCollection items = list.GetItems(query);
            DataTable table;
            table = new DataTable();
            table.Columns.Add("Title", typeof(string));
            table.Columns.Add("Hyperlink", typeof(string));
       table.Columns.Add("Created by", typeof(string));
            DataRow row;
            foreach (SPListItem result in items)
                row = table.Rows.Add();
                row["Title"] = result.Title;
                row["Hyperlink"] = result.Name;
       SPFieldUser userField = (SPFieldUser)result.Fields.GetField("Users");
                SPFieldUserValue userFieldValue = (SPFieldUserValue)userField.GetFieldValue(result["Users"].ToString());
                SPUser user = userFieldValue.User;
                string name = user.LoginName;
       row["Created by"] = name;
            grdList.DataSource = table.DefaultView;
            grdList.DataBind();

Similar Messages

  • Creating search help for AFNAM, and display the hit list with values only

    Hi guys,
    I have created a search help for AFNAM, but the hit list displays all even if it is blank.
    I want to display in the hit list the AFNAM with values and do not diplay the blank values...
    Is it possible? How am i going to do it?
    Thanks!
    Mark

    Hi Mark,
    After selecting data use this statement.
    DELETE it_table WHERE AFNAM is initial.
    Regards,
    Suneel G

  • How to store ,retrieve and display the data in the structured format?

    Hi All,
    We have a requirement in which we need to store a information of type some thing like as below:
    "The PCM_OP_SEARCH opcode fails for the below search used in invoicing module:
    0 PIN_FLD_POID           POID [0] 0.0.0.1 /search -1 0
    0 PIN_FLD_FLAGS           INT [0] 728
    0 PIN_FLD_TEMPLATE        STR [0] " select sum( 1.F8 ), 1.F9 from /event 1, /item 2 where (2.F1 = V1 and  2.F5 >= V5 and 2.F6 < V6 and 2.F2 = V2) and 2.F3 = 1.F4 and  1.F7 like V7 group by 1.F9 "
    0 PIN_FLD_ARGS          ARRAY [1] allocated 20, used 1
    1     PIN_FLD_AR_BILLINFO_OBJ   POID [0] 0.0.0.1 /billinfo 10773245 3
    0 PIN_FLD_ARGS          ARRAY [2] allocated 20, used 1
    1     PIN_FLD_BILL_OBJ       POID [0] 0.0.0.0  0 0
    0 PIN_FLD_ARGS          ARRAY [3] allocated 20, used 1"
    I understand that we can store this as a Blob or Bfile format.But I need to retrieve the data and display it on the GUI in the same format.
    Can anyone please suggest me how can I achieve the same in APEX?
    Thank you for your time !!
    Regards,
    Shan

    And what would be wrong with putting this into a plain old table with columns, on which you could then create a form+report?

  • I have a sharepoint custom list with Title and image attachments, now i want to display image attachments in div based on the title.

    hi,
    i have a sharepoint custom list with Title and image attachments, now i want to display image attachments in div based on the title.

    i am using the below code only
     SPSite mySite = new SPSite("http://sharepoinsiteaddress");
    SPWeb myweb = mySite.OpenWeb();   
    SPList myList = myweb.Lists["Announcements"];   
    SPListItem myListItem = myList.GetItemById(1);   foreach (String attachmentname in myListItem.Attachments)
    String attachmentAbsoluteURL =    myListItem.Attachments.UrlPrefix // gets the containing directory URL
       + attachmentname;
       // To get the SPSile reference to the attachment just use this code
      SPFile attachmentFile = myweb.GetFile(attachmentAbsoluteURL);
       // To read the file content simply use this code
       Stream stream = attachmentFile.OpenBinaryStream();    StreamReader reader = new StreamReader(stream);
       String fileContent = reader.ReadToEnd();
    here i am using panel, how can i attach this attached image to panel

  • Help me Please.. I can log on to the Apple website to manage my account and all the information is correct, but I get "Your Apple ID has been disabled" when I try to get something from App Store on my iPad

    Help me Please.. I can log on to the Apple website to manage my account and all the information is correct, but I get “Your Apple ID has been disabled” when I try to get something from App Store on my iPad3
    I'm from poland.
    Thx
    Balbi

    Contact iTunes Customer Service and request assistance...
    Use this Link  >  Apple  Support  iTunes Store  Contact

  • HT2589 I am trying to create a new account but every time I put in my billing information and numbers, the same screen pops up with, in red "For assistance contact iTunes Support". I am currently overseas and want my imessage to work correctly

    I am trying to create a new account but every time I put in my billing information and numbers, the same screen pops up with, in red "For assistance contact iTunes Support". I am currently overseas and want my imessage to work correctly

    to contact iTunes store support, follow these steps:
    1. Go to expresslane.apple.com
    2. select 'itunes' and then 'itunes store'
    3. select a topic and a subject
    4. click 'continue' and then 'email'
    5. fill out the form and explain your situation
    6. they will respond within 24 hours usually
    Good luck

  • When logging in into yahoo mail after typing in password Firefox is adding something, login fails all the time. At yahoo mail Notepad does not work because it is impossible to close the list of items and they cover information, so I have to go to IE.

    When logging in into yahoo mail after typing in password Firefox is adding something, probably remembered password and login fails all the time. At yahoo mail Notepad does not work because it is impossible to close the list of items and they cover information, so I have to go to IE.

    Only when i go to a different browser (like IE) after i clear it , then all that shows up is the pages i visited in IE , that is what bugs me , why is IE browsing history sowing up in Firefox ??
    Basically , i can clear the history in Firefox , and then for a example , go to Craigslist , using IE7 (launching it from a complete different Icon , in other words at that time i never open Firefox) , then after closing out , or even leaving open as it does not seem to matter , i go into Firefox , and hit History , and there is every place i visited in IE7 , on my History in Firefox

  • I can log on to the Apple website to manage my account and all the information is correct, but I get "Your Apple ID has been disabled" when I try to get something from App Store on my iPhone.

    I can log on to the Apple website to manage my account and all the information is correct, but I get “Your Apple ID has been disabled” when I try to get something from App Store on my iPhone.

    You need to contact Apple Support, particularly iTunes Store support team.  Cheers!

  • Hi I want to create a search form with drop down search criteria. This form should then search on the same site and display the search results. Is there HTML available for this? Or an oline site that I can use to build this form? I created a form in Jotfo

    Hi I want to create a search form with drop down search criteria. This form should then search on the same site and display the search results. Is there HTML available for this? Or an oline site that I can use to build this form? I created a form in Jotform.com, but this form doesn't search the site, instead it sends me an e-mail. Do you have a solution for me? Thanks.

    Hi I want to create a search form with drop down search criteria. This form should then search on the same site and display the search results. Is there HTML available for this? Or an oline site that I can use to build this form? I created a form in Jotform.com, but this form doesn't search the site, instead it sends me an e-mail. Do you have a solution for me? Thanks.

  • Create new external window and displays the viewdata as pdf?

    Hi,
    I have developped an application that will display some textviews and one table that displays 5 records,
    for this I want display as new External window and dispay in PDF the data what we have in view.
    advise me how to approach for external window and diplay as PDF.
    Thanks,
    Lohi.
    Message was edited by:
            Lohitha M

    Thanks for your reply,
    Here my problem is now I am getting the table values as output in the Jsp.
    In Jsp I want to create Button when I click that button I need to display an external window and display the table data what ever is available that will display new external pdf.
    I have developped the applcation by using of the three files table.java,tablebean.java,table.jsp and in portalapp.xml cretated the component.
    Now  how can I perform my action in that existed Jsp page and how to display extenal window i that how to generate the PDF.
    I am in learning stage in this.
    please elobarate with atleast some snippests.
    Thanks,
    Lohi.
    Message was edited by:
            Lohitha M

  • I have created a DVD via iMovie and burned several copies. When played the DVD's will stop and display a message SKIPPING DAMAGED Part. It is not the DVD. When trying to export the project, I get an error message.

    I have created a DVD via iMovie and burned several copies. It is a large file. When played the some DVD's will stop and display a message SKIPPING DAMAGED Part but will not resume. Some work fine.  It is not the DVD. I have burned from several batches. When trying to export the project, I get an error message with the following message: The project could not be prepared for publishing because an error occured (-108).

    TV video typically is copyrighted content.  We'd be breaking several rules trying to help you.  Good luck!

  • Itunes will open, but I cannot play any songs, nor enter the store.  It displays the message 'itunes have stopped working' and then closes

    I went in to use itunes today.  It opened up right away, but I can't play any songs nor enter the store.  It displays the message ' itunes has stopped working' and then closes.  I tried removing itunes and reloading.  Same thing.  This is on my PC.  My wife can still open itunes on her PC.  Can anyone help?

    Hello printer12
    Start your troubleshooting with the article below as it goes over issues with iTunes crashing and multiple options to troubleshoot.
    iTunes for Windows XP: Troubleshooting unexpected quits, freezes, or launch issues
    http://support.apple.com/kb/ts1421
    Regards,
    -Norm G.

  • Creating custom lists that are links to SharePoint sites.

    I am new to SharePoint 2013 Online and was wondering if there is a non-coding way to build a sub-site from a template that is not initially connected to a site collection. Attach this sub-site to a site an already existing site collection afterwards and
    use data from the sub-site that is created, to generate a custom list items that can also be used as links to the sub-site itself.
    How I thought this might work would be to create templates for site collections (if that is even possible), and then use a links list or some other type of linked list but not exactly sure how this is done in SharePoint.
    Any input on how to go about this would be greatly appreciated as well as any insight as to whether this is even possible to do with out coding. Thanks in advance.

    Hi,
    According to your post, my understanding is that you wanted to create custom lists that are links to SharePoint sub-sites.
    I recommend to create a custom list and add a multiple line column to display the sub-sites url.
    Then create a workflow associate a custom list and use “Call HTTP Web Service" action and “Build Dictionary" action to get the count of the sub-sites.
    Then use the Loop Stage to create a new item in the custom list and set the multiple line column to the url you get in the dictionary.
    Here is a great blog for you to take a look at:
    http://sergeluca.wordpress.com/2013/04/09/calling-the-sharepoint-2013-rest-api-from-a-sharepoint-designer-workflow/
    In addition, you can use the build-in webservice via SharePoint Designer.
    More information:
    http://www.balestra.be/2012/03/show-all-subsites-on-a-sharepoint-2010-page-without-code-via-sharepoint-designer.html
    Best Regards,
    Linda Li
    Linda Li
    TechNet Community Support

  • I need to set up an expense form so that our consultant can "filter" by customer type, program type, and finally the purpose of the trip. For instance: the customer types are churches, schools, organizations. The program type would be fund raising, gift p

    I need to set up an expense form so that our consultant can "filter" by customer type, program type, and finally the purpose of the trip. For instance: the customer types are churches, schools, organizations. The program type would be dependent on the customer type selection from the first list. Some examples would be: fund raising, gift planning, surveys, and others. The purpose of the trip would be dependent on the program type selected from the second list. Some examples of trip purposes would be: presentation, design, prospecting. Further, the purpose of trip selection from the third drop-down box would then have to determine the values of other fields by expense type: such as commission, airfare, hotel. etc. I've tried pop-up menu but can't figure out how to "select" from the final popup list and have it populate a field for the purpose of the trip. I've tried to look at the JavaScript examples for dependent drop-down boxes, but can't find any that quite fit what I'm trying to accomplish. I am very new to all of this. No training in writing Javascripts - just trying to wing it. The form has to be very simple for our consultants to use, but also give our office the detail we need to process through the correct account numbers. I would appreciate any detailed step-by-step instructions - kind of a javascript for dummies type of info. HELP!

    An AcroForm is the name given to the type of PDF form that you create in Acrobat. An XFA form is the type of form that you create in LiveCycle Designer. Although they are both PDF files, they are very different structurally and have significant;y different scripting models. So pay attention to the information on AcroForms and ignore anything about XFA. Be sure to get the sample PDF forms so you can look at how it works and where the scripts are placed.
    What you want to do will require scripting, and if you don't have the experience and are unable to use the information in the tutorials to create what you want, you might consider getting someone who has experience do this for you. I'll often suggest code if I can do so quickly, but what you want requires more than a few minutes.

  • Creating Bar Charts using Java and Display in jsp

    Hi..Is it possible to create a servlet that processes data from database and display the values as Bar Charts in jsp pages. If its possible, is there any examples on how to achieve that?

    I don't get it. You already know what needs to be done to solve your problem, the only thing you are missing is the HOW. That's the easy part, if only you break down what you have to know:
    1) how do I show an image on a website (this is a basic HTML question actually, not actually related to servlets/JSPs directly)
    2) how do I fetch the path from a database (JDBC question) so that I can use this path to link to my image on disc
    So what is preventing you from figuring out how to do these two simple tasks? Some clever google searches should give you all the information you need in no time.
    by the way: are you sure that you need to store these paths in the database? Is this part of some file upload component?

Maybe you are looking for

  • Address Book Contact Photos will not sync over to iPhone 2G

    So here is the deal. I just bought a new 21.5" iMac w/ Snow Leopard. I had a iMac G5 with Leopard previously and rather than using migration assistant, i just copied over the applicable folders and files (per my research) so that my contacts would be

  • Sales Order Field Authorization

    We want to give user to have access in VA02, change the Sales order, but the only field she can change is the Terms of Payment (header or item level).. Is this possible?

  • What is the best way to copy data....

    Hello friends, What could you think is the best way to copy this data ? : - I have two identical databases (Oracle 9i) - I want to migrate the data of 90 tables (all tables begin with the same string, i.e. 'TAB') from Database1 to database2. - There

  • Can Mac Mini boot XP from an External HD ? ? ? ?

    Hi All, Just a quick question. I have a recently deceased PC. RIP. I was able to salvage my boot drive with much of my media content. I would very much like to buy a Mac Mini to use as a PC / Media Center. Can a Mac Mini boot Windows XP from an exter

  • Password Reset Fails

    I have been trying to reset my password for my bestbuy.com account and it always fails.  I get the message (in red) "We're sorry.  We cannot provide password assistance at this time because our system is down.  Please try again later."  Now at first