Hi I am Using Nicedit My WebApplication..It is Nice.
Normally I am using On Save Button for Content Save to Database using Query. I am using Textbox after nicedit it converted as TextArea.
Now I Dont Know how get text's from TextBox means Textarea..
becoz i am using the Code is..
protected void lbtnSave_Click(object sender, EventArgs e) {
divMsg.Visible = true;
if (this.isValidForm())
{
Post oPost = new Post();
oPost.UserID = Convert.ToInt32(Session["UserID"]);
oPost.PostID = iPostID;
oPost.PostDescription = (txtDescription.Text); // Here txtDescription is TextBox Value's! Here only get content From Editor......
if (!oPost.IsExisDescription())
{
if (oPost.SaveDescription())
{
divMsg.InnerHtml = "Save Successfully";
divMsg.Attributes.Add("class", "success");
if (iPostID == 0)
this.ClearFields();
}
else
divMsg.InnerHtml = "Saved Failed";
}
else
{
divMsg.InnerHtml = "You have already Send Same Post!";
divMsg.Attributes.Add("class", "info");
}
}
}
Query:
public bool SaveDescription() {
SQLDAL oDAL = new SQLDAL();
oDAL.AddParamToSQLCmd(oDAL.SQLCommand, "@UserID", SqlDbType.Int, 0, ParameterDirection.Input,iUserId );
oDAL.AddParamToSQLCmd(oDAL.SQLCommand, "@PostDescription", SqlDbType.NVarChar, 500, ParameterDirection.Input, sPostDescription);
oDAL.AddParamToSQLCmd(oDAL.SQLCommand, "@PostID", SqlDbType.Int, 0, ParameterDirection.Input, iPostID);
if (PostID == 0)
sQuery = "INSERT INTO Posts (PostDescription, CreatedBY, CreatedDate, ModifiedBY, ModifiedDate) VALUES"
+ "(@PostDescription, @UserID, GETDATE(), @UserID, GETDATE())";
else
sQuery = " UPDATE Posts SET PostDescription=@PostDescription,ModifiedBY=@UserID,ModifiedDate=GetDate() WHERE PostID=" + iPostID;
oDAL.SetCommandType(oDAL.SQLCommand, CommandType.Text, sQuery);
bool bFlag = Convert.ToBoolean(oDAL.ExecuteNonQueryCmd(oDAL.SQLCommand));
oDAL = null;
return bFlag;
}
Help Me..
Regds A.Riyajudeen