protected void btAdd_Click(object sender, EventArgs e) { if (ValidateInsertFields()) { lblMessage.Text = ""; try { DS_Main.Insert(); lblMessage.Text = "Message was successfully added !!!"; ClearInsertFields(); string script = "<script type=\"text/javascript\">alert('Message was successfully added !!!');</script>"; ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", script); BindData(); } catch (Exception ex) { lblMessage.Text = "Error: " + ex.Message; string script = "<script type=\"text/javascript\">alert('Error: " + ex.Message + "');</script>"; ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", script); } } }
protected void gridList_PageIndexChanging(Object sender, GridViewPageEventArgs e) { gridList.PageIndex = e.NewPageIndex; DataView dv = (DataView)DS_Main.Select(DataSourceSelectArguments.Empty); gridList.DataSource = dv; gridList.DataBind(); }
protected void BindData() { DataView dv = (DataView)DS_Main.Select(DataSourceSelectArguments.Empty); gridList.DataSource = dv; gridList.DataBind(); ModifiedDate.Text = DateTime.Now.ToString("MM/dd/yyyy"); }
protected void gridList_RowDeleting(object sender, GridViewDeleteEventArgs e) { lblMessage.Text = ""; int UID = int.Parse(gridList.DataKeys[e.RowIndex]["UID"].ToString()); logger.Debug("deleting board message - " + UID.ToString()); DS_Main.DeleteParameters["UID"].DefaultValue = UID.ToString(); DS_Main.Delete(); //logger.Debug("binding news "); BindData(); }
protected void btSave_Click(object sender, EventArgs e) { if (ValidateUpdateFields()) { try { DS_Main.Update(); lblMessage.Text = "Message was successfully updated !!!"; ClearUpdateFields(); } catch (Exception ex) { lblMessage.Text = "Error: " + ex.Message; } } }
protected void btAdd_Click(object sender, EventArgs e) { if (ValidateInsertFields()) { lblMessage.Text = ""; try { DS_Main.Insert(); lblMessage.Text = "Message was successfully added !!!"; ClearInsertFields(); BindData(); } catch (Exception ex) { lblMessage.Text = "Error: " + ex.Message; } } }
protected void BindData() { DataView dv = (DataView)DS_Main.Select(DataSourceSelectArguments.Empty); if (dv.Table.Rows.Count > 0) { DataRow row = dv.Table.Rows[0]; lblUID.Text = row["UID"].ToString(); ddlBoardCatID.DataBind(); ddlBoardCatID.SelectedValue = row["BoardCatID"].ToString(); tbBoardTitle.Text = row["BoardTitle"].ToString(); txtBoardContent.Value = row["BoardContent"].ToString(); txtBOrder.Text = row["OrderNoDisplay"].ToString(); ModifiedDate.Text = DateTime.Parse(row["ControlDate"].ToString()).ToString("MM/dd/yyyy"); } }
protected void gridList_RowDeleting(object sender, GridViewDeleteEventArgs e) { lblMessage.Text = ""; int UID = int.Parse(gridList.DataKeys[e.RowIndex]["UID"].ToString()); string script = "<script type=\"text/javascript\">alert('deleting board message - " + UID.ToString() + "');</script>"; ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", script); logger.Debug("deleting board message - " + UID.ToString()); DS_Main.DeleteParameters["UID"].DefaultValue = UID.ToString(); DS_Main.Delete(); //logger.Debug("binding news "); BindData(); }