How do I get a web part to display items from a dropdownlist?

I have a DropDownList that am filling with items from a list. The part of my code that am using to read the list and populating the drop down works just fine. I am now trying to figure out how to display the contents of the drop down on a web part. I know
it sounds like a straight forward and easy thing to figure out, but I have blanked out. Does anyone have a snippet I can take a look at? This is how I am currently reading from a list to create the drop down...
protected override void CreateChildControls()
string title = string.Empty;
EditorChoices = new DropDownList();
string siteUrl = "mySite";
using (SPSite site = new SPSite(siteUrl))
SPWeb web = site.RootWeb;
SPList list = web.Lists["testList"];
SPQuery testQuery = new SPQuery();
testQuery.Query = "<Query><Where><Geq><FieldRef Name='Title'/>" +
"<Value Type='Number'>10</Value></Geq></Where></Query>";
foreach (SPListItem item in list.GetItems(testQuery))
title = Convert.ToString(item["Title"]);
EditorChoices.Items.Add(title);
Controls.Add(EditorChoices);
base.CreateChildControls();
ChildControlsCreated = true;
I basically want to display the items returned from the query, which are now in the dropdownlist, to be displayed on my custom webpart. I really appreciate the help.
Thanks
UPDATE: My dropdownlist is a web part property. So when editing the web part, the drop down control appears in the web part property. Now that part is working just fine. The part am having an issue with is, the second part of my requirement is that I want
to display that same information within the drop down on the web part. Not as another drop down, but just to display them as a vertical text list on the web part.

Hello,
>I want to be able to display all the entteries in the dropdown,
Could you please provide more information? as per your description fisrt part is done, which was filling data in dropdown list. So what is next?
If you want to get selected value from dropdown or filter value then you may try this link:
http://bilbrobloggins.com/sharepoint/dropdown-list-box-filter-web-part-in-sharepoint-ndash-part-three/
http://tmullenssharepoint.wordpress.com/2013/04/12/sharepoint-custom-web-part-properties-from-sharepoint-list/
Correct me if i misunderstood
Hemendra:Yesterday is just a memory,Tomorrow we may never see
Please remember to mark the replies as answers if they help and unmark them if they provide no help

Similar Messages

  • How to configure search results web part to display results only after a query is generated from user?

    Hi All,
    I am crawling documents from a file server. I created a new content source and crawled the documents. All documents are crawled successfully.
    Then I went to my enterprise search center site collection and created a new result source. I have added the query to use above content source.
    After that, on a page I am trying to configure the search results web part to display documents using this result source. Now the problem is:
    It displays all the documents that are crawled without searching for anything. I mean first it should not display any results. If a user searches for something , then according to that search it should display results.
    Any idea how to do this in the web part? I am using SharePoint 2013 on premise enterprise edition. No code. Totally OOTB.

    Hi Mohan,
    What did you use for the Query text in the result source?
    I could reproduce this issue when I used Query text like: {searchTerms} Path:”http://sps2k13sp/sites/First/Shared%20Documents”
    Then I changed the Query to
    {?{searchTerms}
    Path:"http://sps2k13sp/sites/First/Shared%20Documents"}
    , then Search result web part didn’t return results without searching.
    So , check your result source, and use the Query like the above(adding "{?...}").
    I hope this helps.
    Thanks,
    Wendy
    Wendy Li
    TechNet Community Support

  • Using Content search web part to retrieve items from another site collection

    I have a web application that contains two site collections(team site + enterprise wiki), with the following URLs:-
    -http://applicationname/teamsite
    -http://applicationname/enterprisewiki
    Now I need to display the latest 10 wiki pages from the enterprise wiki site collection(according to the modified date) inside the team site. So I read that using Content search web part allow for cross-site content query. Currently I added a new content
    search web part , inside my team site, and I click on “change query” button. But I am not sure how I can reference the enterprise wiki site collection's wiki page library and to specify that I need to get the latest 10 wiki pages , inside the following dialog:-
    Basically this setting partially worked for me, I provide the following settings inside the “Build Your Query” dialog:-
    From the “Select a Query” I defined the following:- “items matching content type(system).”
    Restrict by app : “Do not restrict results by app”
    Restrict by content type “Enterprise Wiki Page”.
    This showed all the sites, lists and even pages are based on the “Enterprise Wiki Page” content type. But I am facing these three problems:-
    1. The above setting showed only the sites,lists and pages matching the “Enterprise Wiki Page” content type, that exists on another web application, and not that exists inside the current web application.
    2. To test the web part , I got the following results, But I was not able to add additional info for the items such as created by, modified by ,etc.
    3.  Also there is no way to sort the wiki pages by the modified date, as in the Sorting tab inside the “Build Your query” dialog I cannot find the “modified” inside the Soft by list
    So can anyone advice how to fix these three problems

    Hi,
    1. In "Build Your Query" dialog, we can select "Specify a URL" in
    Restrict by app and enter another site URL.
    2. If you want to add more information for the items, we need customize the display template, the following link for your reference:
    http://blogs.technet.com/b/sharepoint_quick_reads/archive/2013/08/01/sharepoint-2013-customize-display-template-for-content-by-search-web-part-cswp-part-1.aspx
    3. In the Sorting tab, we can use "LastModifiedTime" to instead of "Modified".
    Best Regards 
    Dennis Guo
    TechNet Community Support

  • Can a content query web part dynamically query items from a particular that exists in multiple subsites

    I have a site collection with multiple subsites. All of the subsites have a list called "Status" which is using content types for its column management.
    I want to use a content query web part in the parent site level to query 1 item from everyone of these subsites. Is there a way to do this?
    The only way I can do this is if I create an individual content query web part for each subsite as I did not find an option for my content query to query from multiple subsites at once.

    You can do it using CQWP. For instance, if you have a site column called 'Rollup' that is part of your content type, that will be part of all your subsites custom list 'Status'. On the root site CQWP set the source to 'Show item from the following site and
    all subsites' and choose your root site (first image below). Then add 'additional filters' and set the value to 'Yes' as shown in second figure below; you will be able to roll up all the data to the root site like below. Now, you need to decide what query
    field you will use that is unique and that can roll up. 
    Srini Sistla Twitter: @srinisistla Blog: http://blog.srinisistla.com

  • How to get "Calendar in the View" displayed on the page where Calendar web part is displayed?

    I have a calendar with overlay set up for 5 views. When the calendar list is open in full page, the "Calendars in View" is displayed on the left pane with all 5 views listed by colors.
    1) I want to display the calendar right on the home page, so I added the calendar web part to the page. But the problem is the "Calendars in the View" does  not show up on the quick launch on home page, it only shows up in calendar list view.
    How can I get "Calendars in View" displayed on left pane when calendar web part is displayed? so that users can select different views?
    2) Also it will be better if the "Calendars in View" can display all components of the overlay when not in the default view, so user can toggle thru different views to see each one on the main pane.
    Currently, only the default view has all colored views displayed under "Calendars in Views", once you click another view on the list, it just displays the current view, and you have to click the "Calendar" to see all and select another
    one.
    Really appreciated if someone can give a solution for at least the #1 problem. great if you have a solution for #2 as well!

    Hi,
    According to your post, my understanding is that you wanted to know how to add iFrame via Content Editor web part.
    There are two articles for your reference.
    How to insert an iFrame into a SharePoint web page
    Embed YouTube video in SharePoint 2010
    Thanks & Regards,
    Jason
    Jason Guo
    TechNet Community Support

  • How to create web part and retrieve data from a scheduled task?

    Hi,
    I am new to SP, so I think you can guide me. I have  a scheduled task which gets currency data. I wonder if there is  way to show them on a web part. There will be currnecy names, buy and sell data on this web part. I would be glad if you can show
    me step by step how to create this web part on SP.
    Thanks in advance.
    Best Regards.

    Hi,
    thanks for the reply so I advice on that case to write code in the task schedule to write the data into a SharePoint list, if the scheduled task is on the same server as SharePoint then use Object model if it on another server then use client object model
    to write data to a list
    then on SharePoint site you will just add out of the box web part to display the list where you stored the data
    to save data using Object model:
    http://msdn.microsoft.com/en-us/library/office/ms467435(v=office.14).aspx
    http://www.go4sharepoint.com/Code/insert-list-item-sharepoint-object-286.aspx
    to save data using client object model
    http://www.codeproject.com/Articles/268196/SharePoint-Client-Object-Model
    Kind Regards,
    John Naguib
    Technical Consultant/Architect
    MCITP, MCPD, MCTS, MCT, TOGAF 9 Foundation
    Please remember to mark your question as answered if this solves your problem

  • I downloaded Firefox 3.6 and now my tool bar is gone. No back arrows, forward arrows, file, edit, view, history, bookmark, tools....how do I get my web browser to look like a regular browser again?

    I downloaded the new Mozilla web browser and I had a Bing homepage setting. I changed back to yahoo but I ever since downloading I dont have any back arrows, forward arrows, file, edit, view, history, bookmark, tools, address bar....how do I get my web browser to look like a regular browser again?

    For details of how to restore the menus see [https://support.mozilla.com/kb/menu+bar+is+missing]
    Once the menus are back, you can use the View menu, then select Toolbars and click on the names of the toolbars to toggle displaying them.

  • How can I get my web cam to work in Adobe Connect ?

    This is actually an end user's question that I am having trouble answering to...
    We use Adobe Connect to give online language classes, the end user is one of the students.
    I cannot find the right Support answer to give him.
    Problem:
    My camera does not work when I connect to Adobe's rooms but camera works fine with other software.
    Even though I suspected my old camera was working fine, yesterday I went ahead and bought a new camera. 
    I thought perhaps my webcam software may have been a problem, so I bought a different type camera with different software. 
    Even after removing all the old software, same result:  
    I surmised the problem might be caused by my firewall and security software, so once I tried changing the permissions for Adobe, and my Webcam, but that didn’t work.   
    Another time, I restarted my computer right before class and then turned off my firewall completely so there would be no interference but to no avail. I’m totally perplexed.  
    Isn’t there anyone else experiencing a similar problem?   Has anyone else found a solution? 
    I run Windows Vista with McAfee Internet Security Software.  I always reboot the computer before class and open no other programs other than Google Chrome. 
    I now have a brand new Microsoft LifeCam Cinema Camera with LifeCam 3.5 Webcam Software. 
    I test my camera before going online.  It always works fine.   Then I shut down the camera program and login into class.   
    When I “connect webcam” in the room, the light on my camera comes on (suggesting that it is ON), but only a black image is transmitted to the room.

    Check to see if you have Google Voice installed. If so, remove it and see
    if your problem vanishes. If not Google Voice, check to see if you have
    any other communications software which interacts with your cam and
    disable it. This was the problem I had with a similar problem on a Mac.
    MosesJOI <[email protected]>
    10/13/11 12:08 PM
    Please respond to
    [email protected]
    To
    jsb152 <[email protected]>
    cc
    Subject
    How can I get my web cam to work in Adobe Connect ?
    Re: How can I get my web cam to work in Adobe Connect ?
    created by MosesJOI in General Discussion - View the full discussion
    Thanks a lot Heyward for the swift reply !
    I sent the advice out to the end user, but unfortunately this wasn't the
    solution.
    His reply is below :-
    The default resolution of my new camera is already set at 640x360, but I
    went ahead and tried several lower resolutions (e.g. 424x240; 320x240; and
    160x120) but none worked in the room - camera still showed up as black
    blank screen.  Also, as far as I can tell, I don’t have the option of
    adjusting the frame rate.
    I started playing around with my Internet Security Settings to see if they
    might be playing a role. So far, all to no avail.
    Hmm...quite a tricky one - webcams always are - maybe if he can find a way
    to adjust the frame rate (?).
    He's going to fiddle about with the settings a bit more and see if
    something does the trick.
    If anyone has had a similar problem and found an ingenious solution,
    please jot on a note on this thread.
    Replies to this message go to everyone subscribed to this thread, not
    directly to the person who posted the message. To post a reply, either
    reply to this email or visit the message page: [
    http://forums.adobe.com/message/3969561#3969561]
    To unsubscribe from this thread, please visit the message page at [
    http://forums.adobe.com/message/3969561#3969561]. In the Actions box on
    the right, click the Stop Email Notifications link.
    Start a new discussion in General Discussion by email or at Adobe Forums
    For more information about maintaining your forum email notifications
    please go to http://forums.adobe.com/message/2936746#2936746.

  • How do I get my web pages back to original size? My fonts are all too large and keep reverting after I change them back!

    How do I get my web pages back to original size? My fonts are all too large and keep reverting after I change them back!

    That has not worked. I do it and still it reverts. Isn't there a way to tell Firefox to just go back to default settings?

  • How do I get Apache web server working ...

    How do I get Apache web server working on my MacBook Pro, which is running Leopard 10.5.8?
    When I enter 'http://localhost/~username/' (without the quote marks) as a URL in my Firefox browser on the MacBook, I do not see any result at all(!). I do have Web Sharing on in System Preferences on that machine. But the browser does nothing whatever for that URL ...
    On my other computer, an iMac running Leopard 10.5.8, when I enter 'http://localhost/~username/' I see the default "Your Website Here" page. That same default page is in fact the index.html file I expect to see on the MacBook Pro. But it isn't getting invoked for some reason. Nothing is happening ...
    When on the iMac I try 'http://10.0.1.18/~username/' (10.0.1.18 is the local IP address I see under 'Web Sharing: On' on the MacBook) I get "Unable to connect: Firefox can't establish a connection to the server at 10.0.1.18."
    When on the MacBook I try 'http://10.0.1.5/~username/' (10.0.1.5 is the local IP address I see under 'Web Sharing: On' on the MacBook) I see the default "Your Website Here" page.
    It is the same on my iPhone: Using the same local IP addresses and usernames, Safari can see the index.html page on my iMac but not on my MacBook.
    It looks as if Apache is not working on the MacBook, while on the iMac it works fine.
    On the MacBook I can see (after I use 'defaults write com.apple.finder AppleShowAllFiles TRUE' in Terminal) a /private/etc/apache2/ directory with what look to be(?) the usual contents. So it looks like Apache is duly installed, as far as I can tell.
    On the MacBook I don't see a file at /private/var/log/apache2/error_log, which is the location for 'ErrorLog' given in the httpd.conf file.
    That about exhausts my understanding of how to get a handle on my problem.
    Any advice or suggestions from those who have more expertise with Apache will be much appreciated ...

    Okai, so we are getting somewhere, but not quit there yet :-)
    I opened the Kenneth.conf file using the command: vi Kenneth.conf
    This is what it said:
    <Directory "/Users/Kenneth/Sites/">
    Options Indexes Multiviews
    AllowOverride AuthConfig Limit
    Order allow,deny
    Allow from all
    </Directory>
    "Kenneth.conf" [readonly] 6L, 139C
    I therefore changed the AllowOverride from AuthConfig Limit to None, which was the only difference from what you posted above. Something did change, when I tried to open XAMPP it prompted me a password, but Apache still wont start :-/

  • How to enable a custom web part class file to be refreshed at regular interval of time, without affecting the entire page where its placed.

    Hi,
    I am calling a web service in the web part class file where it gets the data. I need to call the service at regular intervals of time which is in the web part, is there a way to get the web part refreshed automatically at certain intervals of time.
    Rayudu

    You can use Ajax for automatic refreshing.
    Add a timer control into an Ajax Update panel within your custom web part and execute your code to refresh the field values within the Timer_Tick() event.
    You can also control the timer interval to 10 minutes or so using the Timer.Interval property.
    This will always enable your page to remain with only the web parts getting refreshed.
    I just found
    a blog post which describes this in detail with screenshots.

  • Data view web part to display the most frequently accessed pages based on the user that is logged in

    I am working on a project in which I would like to display the top 5 most accessed pieces of content as links, based on the user that is logged in. Our MOSS 2007 implementation has subsites for all regions that we do business in, as an example North, South, East, and West. When a user visits the North region homepage, I would like a web part to display:
    Hello, <username>, here is a listing of your most accessed content:
    Link to One
    Link to Two
    Link to Three
    Link to Four
    Link to Five
    So each user would get a customized list based on their content access. We are not using my sites, but these would not work as we want the list to display on the home page of the region site.
    I am thinking that a data view may work here, but I am not sure. Any help is greatly appreciated.

    If you are running MOSS you may want to take a look at the Relevant Documents web part too.
    http://office.microsoft.com/en-us/sharepointserver/HA102410251033.aspx
    The Relevant Documents Web Part helps you create a personalized view of the documents that you create, check out, and change. In a large Document Center, the Web Part can save you time and effort by making files easier to find and use. The following figure shows the Web Part:

  • Content search web part to display only lists and libraries

    Hi,
    I want to configure Content Search Web Part to display only the names of lists and libraries inside my site collection. I tried adding Keyword filter "Only return lists and libraries", however it is also returning list items. Any idea on this issue?

    Hi John,
    Thanks.
    Agree with your point. I can't use any code (that is client requirement). Also, still I use, I can't use it in this scenario. I want to display most visited lists and libraries (in last month or lifetime). I can use managed properties such as ViewsLifeTime
    and ViewsRecent to sort it If i get the names of lists and libraries. Let me know if this clarifies the question more and you have an idea about it.

  • Adobe reader xi i am running 2 display screens and when i have a file open and go to print the print page opens on my second screen.  How can I get adobe reader to just display on one screen?

    adobe reader xi i am running 2 display screens and when i have a file open and go to print the print page opens on my second screen.  How can I get adobe reader to just display on one screen?
    I want the capability of adobe reader to just run on one screen.

    I had the same problem.
    Try this.
    https://igppwiki.ucsd.edu/groups/publichelpwiki/wiki/a1538/Howto_Disable_Acrobat _as_the_Safari_PDF_Viewer.html

  • How do I get rid of the auto signature "sent from my iPhone" when I create a new message?

    how do I get rid of the auto signature "sent from my iPhone" when I create a new message?

    Settings -> Mail -> Signature and edit it to whatever you'd like.

Maybe you are looking for