Monday, 4 June 2012

ASCX.CS(.ascx.cs)

STEP 1: Create a VisualWebPart like HealthAndWellness

STEP 2: Write a coding in HealthAndWellnessUserControl.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.HealthAndWellness
{
    public partial class HealthAndWellnessUserControl : BasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsSuperAdmin || IsAdmin || IsManager)
            {
                imgbtnHealthAdd.Visible = true;

            }
            else
            {
                imgbtnHealthAdd.Visible = false;

            }
        }

        protected void btnHealthSubmit_Click(object sender, EventArgs e)
        {

            if (!string.IsNullOrEmpty(txtHealthTitle.Text) && !string.IsNullOrEmpty(txtHealthDescription.Text) && !string.IsNullOrEmpty(fldHealth.FileName))
            {
                HealthAndWellnessBL healthAndWellnessBL = new HealthAndWellnessBL(txtHealthTitle.Text, txtHealthDescription.Text, fldHealth);
                if (healthAndWellnessBL.insert())
                {

                    //insert success
                }
                else
                {
                    //fail
                }
            }

            clear();
        }
      
        public void clear()
        {
            txtHealthTitle.Text = string.Empty;
            txtHealthDescription.Text = string.Empty;
        }

        protected void btnHealthClear_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 ; ...