Created
May 31, 2013 01:14
-
-
Save devendrasv/5682402 to your computer and use it in GitHub Desktop.
visual webpart cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.ComponentModel; | |
using System.Web.UI.WebControls.WebParts; | |
using System.Data; | |
using Microsoft.SharePoint; | |
namespace First_VisualWebPart.VisualWebPart1 | |
{ | |
[ToolboxItemAttribute(false)] | |
public partial class VisualWebPart1 : WebPart | |
{ | |
// Uncomment the following SecurityPermission attribute only when doing Performance Profiling using | |
// the Instrumentation method, and then remove the SecurityPermission attribute when the code is ready | |
// for production. Because the SecurityPermission attribute bypasses the security check for callers of | |
// your constructor, it's not recommended for production purposes. | |
// [System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Assert, UnmanagedCode = true)] | |
public VisualWebPart1() | |
{ | |
} | |
protected override void OnInit(EventArgs e) | |
{ | |
base.OnInit(e); | |
InitializeControl(); | |
} | |
protected void Page_Load(object sender, EventArgs e) | |
{ | |
} | |
protected void btngettickets_Click(object sender, EventArgs e) | |
{ | |
DataTable dt = GetItemDetails(); | |
ddltickets.DataSource = dt; | |
ddltickets.DataTextField = "Title"; | |
ddltickets.DataValueField = "Title"; | |
ddltickets.DataBind(); | |
} | |
private DataTable GetItemDetails() | |
{ | |
SPWeb spweb = SPContext.Current.Web; | |
SPList ticketsList = spweb.GetList("http://dvlabapp01.cloudapp.net/Lists/Ticket%20Details/AllItems.aspx"); | |
return ticketsList.Items.GetDataTable(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment