Code for adding registration form on SharePoint through Visual Sudio

using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.
using System.Data;
using System.Collections;
using System.Collections.Generic;
using Microsoft.SharePoint;

namespace Sun_SharePointProject2.sunVisualWebPart1
    class Data
        public string studentId { get; set;}
        public string name {get; set;}
        public string address {get; set;}
        public string section { get; set; }
    public partial class sunVisualWebPart1UserControl : UserControl
        protected void Page_Load(object sender, EventArgs e)
                SPList info = SPContext.Current.Web.Lists["Student List"];
                List<Data> data = new List<Data>();
                foreach (SPListItem item in info.Items)
                    Data d = new Data();
                    d.studentId = item["Student ID"].ToString();
           = item["Name"].ToString();
                    d.address = item["Address"].ToString();
                GridView1.DataSource = data;
            catch (Exception ex)
                Label1.Text = ex.Message + "-" + ex.StackTrace;


Popular posts from this blog

StateCode and StatusCode Values for mostly used entities in Microsoft Dynamics CRM 2013

How to show enlarge image when mouse hover on image or link in Asp.Net(c#) using JavaScript

How to import CSV files into DataTable in C#

go to top image