public
partial class PropellerStudioCEUserControl :BasePage
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
if (IsSuperAdmin || IsAdmin || IsManager)
{
Bind();
}
else
{
ImgbtnEdit.Visible =
false;
Bind();
}
}
}
# region
Edit
protected void imgbtnedit_Clik(object sender, ImageClickEventArgs e)
{
ContentEditorBL conBL = new ContentEditorBL();
conBL.GetSingleRowListItem();
string oDesc = null;
SPSite oSPSiteCollection = SPContext.Current.Site;
SPWeb oSPWeb = SPContext.Current.Web;
SPList oSPList1 = oSPWeb.Lists["PropellerStudioCE"];
SPListItemCollection oItemCollectionCourse = oSPList1.Items;
foreach (SPListItem ospListItemCourse in oItemCollectionCourse)
{
oDesc = ospListItemCourse[
"Description"].ToString();
txtDesc.Text = conBL.Desc;
// txtDesc.Text = SPHttpUtility.ConvertSimpleHtmlToText(oDesc, oDesc.Length);
hdnid.Value =
Convert.ToString(conBL.ID);
}
mpupContentEdit.Show();
StringBuilder sb = new StringBuilder();
sb.Append(
"<script type=\"text/javascript\">\n");
sb.Append(
"Sys.Application.add_load(modalSetup);\n");
sb.Append(
"function modalSetup() {\n");
sb.Append(
String.Format("var modalPopup = $find('{0}');\n", mpupContentEdit.BehaviorID));
sb.Append(
"modalPopup.add_shown(SetFocusOnControl); }\n");
sb.Append(
"function SetFocusOnControl() {\n");
sb.Append(
String.Format("var textBox1 = $get('{0}');\n", txtDesc.ClientID));
sb.Append(
"textBox1.focus();}\n");
sb.Append(
"</script>\n");
Page.ClientScript.RegisterStartupScript(Page.GetType(),
"Startup", sb.ToString());
}
# endregion
# region
Bind
private void Bind()
{
ContentEditorBL ConBL = new ContentEditorBL();
ConBL.GetAllListItem();
dv.InnerHtml = ConBL.Desc;
}
# endregion
# region
Update
protected void imgbtnPropellerUpdate_Click(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(txtDesc.Text))
{
ContentEditorBL conBL = new ContentEditorBL(Convert.ToInt32(hdnid.Value),txtDesc.Text);
if (conBL.update())
{
Bind();
}
mpupContentEdit.Hide();
}
}
# endregion
}
partial class PropellerStudioCEUserControl :BasePage
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
if (IsSuperAdmin || IsAdmin || IsManager)
{
Bind();
}
else
{
ImgbtnEdit.Visible =
false;
Bind();
}
}
}
# region
Edit
protected void imgbtnedit_Clik(object sender, ImageClickEventArgs e)
{
ContentEditorBL conBL = new ContentEditorBL();
conBL.GetSingleRowListItem();
string oDesc = null;
SPSite oSPSiteCollection = SPContext.Current.Site;
SPWeb oSPWeb = SPContext.Current.Web;
SPList oSPList1 = oSPWeb.Lists["PropellerStudioCE"];
SPListItemCollection oItemCollectionCourse = oSPList1.Items;
foreach (SPListItem ospListItemCourse in oItemCollectionCourse)
{
oDesc = ospListItemCourse[
"Description"].ToString();
txtDesc.Text = conBL.Desc;
// txtDesc.Text = SPHttpUtility.ConvertSimpleHtmlToText(oDesc, oDesc.Length);
hdnid.Value =
Convert.ToString(conBL.ID);
}
mpupContentEdit.Show();
StringBuilder sb = new StringBuilder();
sb.Append(
"<script type=\"text/javascript\">\n");
sb.Append(
"Sys.Application.add_load(modalSetup);\n");
sb.Append(
"function modalSetup() {\n");
sb.Append(
String.Format("var modalPopup = $find('{0}');\n", mpupContentEdit.BehaviorID));
sb.Append(
"modalPopup.add_shown(SetFocusOnControl); }\n");
sb.Append(
"function SetFocusOnControl() {\n");
sb.Append(
String.Format("var textBox1 = $get('{0}');\n", txtDesc.ClientID));
sb.Append(
"textBox1.focus();}\n");
sb.Append(
"</script>\n");
Page.ClientScript.RegisterStartupScript(Page.GetType(),
"Startup", sb.ToString());
}
# endregion
# region
Bind
private void Bind()
{
ContentEditorBL ConBL = new ContentEditorBL();
ConBL.GetAllListItem();
dv.InnerHtml = ConBL.Desc;
}
# endregion
# region
Update
protected void imgbtnPropellerUpdate_Click(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(txtDesc.Text))
{
ContentEditorBL conBL = new ContentEditorBL(Convert.ToInt32(hdnid.Value),txtDesc.Text);
if (conBL.update())
{
Bind();
}
mpupContentEdit.Hide();
}
}
# endregion
}
No comments:
Post a Comment