Monday, 4 June 2012

ASCX.CS (ascx.cs)

STEP 1: Create a VisualWebPart like PropellerStudio

STEP 2: Write a coding in PropellerStudioUserControl.ascx.cs 


STEP 3:

using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using VCSB.INTRANET.BLL;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Utilities;

namespace VCSB01.INTRANET.VCSBWebPart.PropellerStudio
{
    public partial class PropellerStudioUserControl : BasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            
            try
            {        
            if (!IsPostBack)
            {
                if (IsSuperAdmin || IsAdmin || IsManager)
                {
                    imgbtnPropellerAdd.Visible = true;

                }
                else
                {
                    imgbtnPropellerAdd.Visible = false;

                }
                BindPropellerstudioData();
              
            }
           }
catch (Exception ex)
            {
                ErrorHelper.Add(Convert.ToString(ex.Message), Convert.ToString(ex.StackTrace));
                SPUtility.TransferToErrorPage(MessageHelper.Message(MessageMode.CommonErrorMessage));
            }
        }

        private void BindPropellerstudioData()
        {
            PropellerStudioBL objpropData = new PropellerStudioBL();
            grdPropeller.DataSource = objpropData.GetPropellerData();
            grdPropeller.DataBind();
        }
      
      
        protected void btnPropellerSubmit_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(txtPropellerTitle.Text) && !string.IsNullOrEmpty(txtPropellerDescription.Text) && !string.IsNullOrEmpty(fldPropeller.FileName))
            {
                PropellerStudioBL propellerStudioBL = new PropellerStudioBL(txtPropellerTitle.Text, txtPropellerDescription.Text, fldPropeller);
                if (propellerStudioBL.insert())
                {

                    BindPropellerstudioData();
                    //insert success
                }
                else
                {
                    //fail
                }
            }

            clear();
        }
        public void clear()
        {
            txtPropellerTitle.Text = string.Empty;
            txtPropellerDescription.Text = string.Empty;
        }

        protected void btnPropellerClear_Click(object sender, EventArgs e)
        {
            clear();
        }
    }
}

No comments:

Post a Comment

SharePoint online - Get List-item attachments and Display to div

Step 1 : Create a List ex: TestList and attach few images Step 2 : Copy and Pastet the below coding in App.js var  Items =  null ; ...