How to implement different value for Multiple instances of same webpart in subsites? - instance

I create a webpart, for which values are provided dynamically through the toolpart. I get the proper output. But the problem is when i add a new instance of the same webpart in a subsite, It takes the value from the other tool part,
In simple words, The value in the toolpart remain same for all the instances of the same webpart. I need to handle different value for each instance of the webpart.
Can any of you have a better solution for this problem.

Related

How to add crawl rule to the SharePoint 2010 fast search

We have one Document Library with some set of columns like Type, Name, Active.
We have already configured the SharePoint Fast Search to search the content in the site.
When I am searching with any particular keyword that showing the result as expected.
We got requirement that need to exclude the content form the doc library when the column “Active” is set to ”No”.
Could you please suggest me how can I add crawl rule for the particular doc library.
You are asking to fulfill this requirement using crawl rule. But crawl rule is generic for the content source and it will effect all the content source which is not recommended(and also not possible) for excluding some result depending on item values. So I like to solve this using scope which is described below.
For excluding that, first of all you need to add new managed property for the column "Active".
For that go to search service application-> Managed Property-> New managed property. Give property name and map it to the field "Active". Also select the type of the field "Active". Tick the box for allow this property to be used in scopes.
Then go to corresponding scope-> new rule-> choose property query
then choose from "Add property restriction" corresponding managed property name(property name given by you during managed property creation) and "=" "No"(please use exact field value of the document library), then choose Exclude and click "ok".
Add this scope in the search page and run full crawl in the central admin.
I hope this will fulfill your requirement.

referring to different textboxes on each iteration

I'm making a Visual Basic program. I have a page where I want to be able to scale anywhere from 1 set of two textboxes and a label all the way up to 30. I'd really like to keep the display as simple as possible, So I'm trying to make buttons like add batch and remove batch that lets me adjust the boxes shown from 1 to 30.
I know that I can use a case statement or a if statement or even making a function that does one of those for me so I don't clutter up the main code, but that just seems so klunky. Any suggestions on a way that I can refer to one set at one time and another set at one time?
I ended up creating a class that and passed references ByRef to the class. Created methods of Show*( and Hide() that show and hide all objects that were passed to the class (just changing the Visible property)
Created one object of my new class for each batch set. Made an array with those objects in it, now I can call BatchGroups(3).Show() and iterate through my batches.
Still a bit of setup in my FormLoad event, but BatchGroup(txtBat1,txtBatQty1,lblBat1) and filling an array with those objects allows me to iterate through my batches whether I am adding, removing, adding 5 at a time, removing all but one... take your pick.
Could probably build an array with groupboxes as easily to refer to the whole group at once, but groupboxes would have looked somewhat tacky in this situation, I preferred to create my own object oriented groups.

Create a shared copy and paste menu for my grids

I have 20 or so grids in my application suite. I'd like to create a global copy/paste context menu which I can bind to every single grid rather than code in each form.
I am unsure what is the best way to achieve this, I have started to create a class with my menu in it, but get stuck at the point of adding the actual menu options. For example I know I'll need to call a "copy" event, but I also know I'll need to tell it what I am copying, and I cannot see how that is done in vb.net when you can only add the address of a method minus parameters.
e.g.
.MenuItems.Add("Copy Cell", New System.EventHandler(AddressOf CopyCell))
Obviously I want "CopyCell" to only be coded in one place as well, rather than repeated in each form. I will always be copying the same object (SelectedCellCollection).
I am not sure how to make the menu have an event with parameters, or how to make it "know" that I want to always copy the selected items. I'm aware that I'd have to do some coding in the form but just trying to work out the way to minimize it.
I have created my own context menu class (via inheritance) with specific copy and paste functionality / options tailored to the grid I am using. It works fine and only needs one line of code per form/grid to activate.

Data entry form in sharepoint

I was wondering if anyone knows what a simplest way to create a data entry form in Sharepoint 2010 Foundation would be. Basicly I am looking to create a form that will submit its data to a custom list on the site, I don't want the users to interact with the list directly but use the form to enter data instead.
Also I can't use Designer or InfoPath, not being able to use these is what is causing the problem it seems. Just curious if anyone else has done something like this or could point me in the right direction.
Thanks
Every list is born with forms by default - one for item creation, one for edition and one for displaying. If you use content types, then you get a trio of these for each different type.
You never interact with the list directly, you do it through these forms. If you can't use either Infopath nor Sharepoint Designer, you can still edit them by clicking on the Page tab, then the Edit Page button. From there you can add or remove web parts, and connect them among themselves.
However, the amount of control you have is too limited when compared to editing pages through either of the tools or mentioned, or Visual Studio. For example, there is no straightforward way to add or remove list fields based on content type. Be prepared for ever increasing frustration if you can't use those tools.

How can a custom web part read the list item fields in a display/edit form?

I need to create a custom web part and programmatically attach to the display and edit forms of a list. The web part is meant to display some information (coming from another list) about the list item being displayed on the form.
I know how to add the web part to the list programmatically, but I'm having an issue trying to get the web part to read the list item being displayed on from. I know the SPForm object exposes its parent list but I cannot or don't know how to convert the form to an SPForm object. The parent of the web part is the web part manager and the parent of that is the HTML form object. But when I try convert that to an SPForm object it throws an error.
Also, even if I manage to get hold of the SPForm and its parent list, how can I get hold of the list item being displayed?
Please bear in mind that I need to avoid overwriting the default forms as it will significantly increase the development time.
Any help or idea is appreciated.
Regards