web-parts

Sharepoint: how can i find all the pages that host a particular web part?

こ雲淡風輕ζ 提交于 2019-11-30 15:17:31
As the question says - is there a way to determine which pages are including my web part? If you're looking for code, I've got something for you. If you'd like to find all Content Query web parts then you would call my code like this: FindWebPart("http://server.com/", "Microsoft.SharePoint.Publishing.WebControls.ContentByQueryWebPart"); Here's the code: public static void FindWebPart(string siteCollectionUrl, string webPartName) { using (SPSite siteCollection = new SPSite(siteCollectionUrl)) { using (SPWeb rootSite = siteCollection.OpenWeb()) { FindWebPartHelper(rootSite, webPartName); } } }

How to find the logged in user in Sharepoint?

半世苍凉 提交于 2019-11-29 08:37:16
问题 I have developed a "web part" that has to be deployed on a Sharepoint server. I need the username of the user, who has logged in the sharepoint server within the web part. How do I get that username? 回答1: Following worked for me: SPWeb theSite = SPControl.GetContextWeb(Context); SPUser theUser = theSite.CurrentUser; string strUserName = theUser.LoginName; and check this out. 回答2: You can use: SPWeb web = SPControl.GetContextWeb(this.Context); string userName = web.CurrentUser.LoginName; or

HTML divs can go outside browser window?

三世轮回 提交于 2019-11-29 04:34:25
I was playing around with ASP.NET Web Parts which has a "drop down" div. It's all the way to the right of the page. When I click to bring it up, it goes off the window. Usually anything off the viewable area will trigger the bottom scrollbars. How is this possible? Edit: It's Internet Explorer 8. Below is the markup with some context. The relevant one I think is id=WebPart_wp774658725VerbsMenu. By default it doesn't display. When you click on the td/span Verbs/span VerbsPopup (it could be any), it shows the "dropdown". In Developer Tools I don't see any JavaScript attached to those elements,

Add ScriptManager to Page Programmatically?

久未见 提交于 2019-11-28 16:52:19
I am developing a WebPart (it will be used in a SharePoint environment, although it does not use the Object Model) that I want to expose AJAX functionality in. Because of the nature of the environment, Adding the Script Manager directly to the page is not an option, and so must be added programmatically. I have attempted to add the ScriptManager control to the page in my webpart code. protected override void CreateChildControls() { if (ScriptManager.GetCurrent(Page) == null) { ScriptManager sMgr = new ScriptManager(); // Ensure the ScriptManager is the first control. Page.Form.Controls.AddAt(0

ASP.NET Web Parts: Drag and Drop Support in Non-IE Browsers

南楼画角 提交于 2019-11-28 12:42:32
I have been using web parts on my site since ASP.NET 2.0 came out. Dragging and dropping web parts works great in Internet Explorer, but it doesn't work at all in Firefox, Chrome, or Safari. I recently upgraded the site to ASP.NET 3.5 SP1, but I am still unable to drag and drop web parts in non-IE browsers. How can I enable drag and drop web parts in these other browsers? Update (2/9/2010): This mentions this problem, but offers no solution: http://forums.asp.net/t/1294857.aspx Update (2/19/2010): These posts offer a possible solution, but I have been unable to get it working yet on my site:

HTML divs can go outside browser window?

北战南征 提交于 2019-11-27 18:33:34
问题 I was playing around with ASP.NET Web Parts which has a "drop down" div. It's all the way to the right of the page. When I click to bring it up, it goes off the window. Usually anything off the viewable area will trigger the bottom scrollbars. How is this possible? Edit: It's Internet Explorer 8. Below is the markup with some context. The relevant one I think is id=WebPart_wp774658725VerbsMenu. By default it doesn't display. When you click on the td/span Verbs/span VerbsPopup (it could be any

How to check if a word starts with a given character?

老子叫甜甜 提交于 2019-11-27 14:05:48
I have a list of a Sharepoint items: each item has a title, a description and a type. I successfully retrieved it, I called it result . I want to first check if there is any item in result which starts with A then B then C, etc. I will have to do the same for each alphabet character and then if I find a word starting with this character I will have to display the character in bold. I initially display the characters using this function: private string generateHeaderScripts(char currentChar) { string headerScriptHtml = "$(document).ready(function() {" + "$(\"#myTable" + currentChar.ToString() +

Add ScriptManager to Page Programmatically?

半城伤御伤魂 提交于 2019-11-27 10:00:38
问题 I am developing a WebPart (it will be used in a SharePoint environment, although it does not use the Object Model) that I want to expose AJAX functionality in. Because of the nature of the environment, Adding the Script Manager directly to the page is not an option, and so must be added programmatically. I have attempted to add the ScriptManager control to the page in my webpart code. protected override void CreateChildControls() { if (ScriptManager.GetCurrent(Page) == null) { ScriptManager

How to check if a word starts with a given character?

▼魔方 西西 提交于 2019-11-26 16:26:35
问题 I have a list of a Sharepoint items: each item has a title, a description and a type. I successfully retrieved it, I called it result . I want to first check if there is any item in result which starts with A then B then C, etc. I will have to do the same for each alphabet character and then if I find a word starting with this character I will have to display the character in bold. I initially display the characters using this function: private string generateHeaderScripts(char currentChar) {