A)
When ever you want to add the application page to Particular location in sharepoint site
Get the reference of this site
http://www.customware.net/repository/pages/viewpage.action?pageId=69173255
for example
To add code behind, You need to inherit the class from MenuItemTemplate, and to Capture the Postback events inherit for Interface IPostBackEventHandler
public class MyListSiteActionMenu : MenuItemTemplate, IPostBackEventHandler
{
public MyListSiteActionMenu()
{
this.ID = "myOwnIdHura";
}
protected override void CreateChildControls()
{
this.Text = "Delete Item";
this.Description = "Deletes Item";
this.ClientDEFANGED_OnClickPostBackConfirmation = "Are you sure you want to delete this item?";
this.ClientDEFANGED_OnClickUsingPostBackEvent = this.ID;
}
public void RaisePostBackEvent(string eventArgument)
{
SPContext.Current.ListItem.Delete();
SPUtility.Redirect(SPContext.Current.List.DefaultViewUrl, SPRedirectFlags.Default, this.Context);
}
}
Some more links adressing postbacks of Menuitem template
http://www.dev4side.com/community/blog/2010/3/9/implement-postbacks-in-the-spmenufield-sharepoint's-control.aspx
B)Modifing the text of the MenuItem depending on Custom List Property value
in
Psedo Code as follows
CreateChildControl()
{
//Code to display text of menuitem depending on Custom List Property value
set the text of menuitem according to property of list
}
RaisePostBackEvent(string eventargument)
{
//updated list Propery on menuitem click
list.rootfolder.Addproperty();
list.rootfolder.SetProperty() ;
}
When ever you want to add the application page to Particular location in sharepoint site
Get the reference of this site
http://www.customware.net/repository/pages/viewpage.action?pageId=69173255
for example
To add code behind, You need to inherit the class from MenuItemTemplate, and to Capture the Postback events inherit for Interface IPostBackEventHandler
public class MyListSiteActionMenu : MenuItemTemplate, IPostBackEventHandler
{
public MyListSiteActionMenu()
{
this.ID = "myOwnIdHura";
}
protected override void CreateChildControls()
{
this.Text = "Delete Item";
this.Description = "Deletes Item";
this.ClientDEFANGED_OnClickPostBackConfirmation = "Are you sure you want to delete this item?";
this.ClientDEFANGED_OnClickUsingPostBackEvent = this.ID;
}
public void RaisePostBackEvent(string eventArgument)
{
SPContext.Current.ListItem.Delete();
SPUtility.Redirect(SPContext.Current.List.DefaultViewUrl, SPRedirectFlags.Default, this.Context);
}
}
Some more links adressing postbacks of Menuitem template
http://www.dev4side.com/community/blog/2010/3/9/implement-postbacks-in-the-spmenufield-sharepoint's-control.aspx
B)Modifing the text of the MenuItem depending on Custom List Property value
in
Psedo Code as follows
CreateChildControl()
{
//Code to display text of menuitem depending on Custom List Property value
set the text of menuitem according to property of list
}
RaisePostBackEvent(string eventargument)
{
//updated list Propery on menuitem click
list.rootfolder.Addproperty();
list.rootfolder.SetProperty() ;
}