dickchan
asked on
Add button to web part in WSS3
I want to customize a web part page in WSS3 to show contact list for three offices.
When i click first buttion, the content part show contact list of office 1;
When i click button 2, it show contact list of office 2;
When i click button 3, it show contact list of office 3;
Any idea how can i do this?
I am new to sharepoint.
Thanks a lot.
list.jpg
When i click first buttion, the content part show contact list of office 1;
When i click button 2, it show contact list of office 2;
When i click button 3, it show contact list of office 3;
Any idea how can i do this?
I am new to sharepoint.
Thanks a lot.
list.jpg
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Contacts data is stored in a word file. Each office on file.
Any web part can load the content of the word or PDF file directly?
Any web part can load the content of the word or PDF file directly?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start by adding a required column named Office to your contacts list. Make this a choice column and add your three offices as the list of choices.
Create the webpart in VS and add the three buttons.
Here is the code to filter the list and return the results as a DataTable. Use the DataTable to bind to a grid or iterate through the SPListItemCollection directly if you wish to write out the results yourself. If you use a grid or other bindable control you will need to limit the results to the required fields or you will end up with a lot of unnecessary output as it contains all columns from the list.
public static DataTable GetContactsDataTable(strin
{
DataTable ret = null;
try
{
SPList contactsList = SPContext.Current.Web.List
SPQuery query = new SPQuery();
query.Query = string.Format("<Query><Whe
SPListItemCollection contactsListItems = contactsList.GetItems(quer
ret = contactsListItems.GetDataT
}
catch (Exception ex)
{
//Handle Exception
}
return ret;
}