i want a version of this code below on juery, like calling a data in datalist to formview on model instead of using post back server method . SCRIPT
<script type='text/javascript'>
function openModal9t() {
$('#myModal9t').modal('show');
}
function openModalComments() {
$('#mycomments').modal('show');
}
</script>
--------------------------------------- code
protected void linkonlyPOSTModal_Click(object sender, EventArgs e)
{
ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "myModal9t();", true);
}
-------------------------------------------------------------
protected void btnSUBMTE_Click(object sender, EventArgs e)
{
string modelId2 = (Post.Row.FindControl("lblModalId") as Label).Text;
string userName2 = (Post.Row.FindControl("lblUserName") as Label).Text;
string fuserName2 = (Post.Row.FindControl("lblfUserName") as Label).Text;
string contentPost2 = (Post.Row.FindControl("lblpost") as Label).Text;
string comment2 = (Post.Row.FindControl("txtcomment") as TextBox).Text;
string img2 = (Post.Row.FindControl("Image2") as System.Web.UI.WebControls.Image).ImageUrl.Split('/')[(Post.Row.FindControl("Image2") as System.Web.UI.WebControls.Image).ImageUrl.Split('/').Length - 1];
string imgpostImage2 = (Post.Row.FindControl("postImage") as System.Web.UI.WebControls.Image).ImageUrl.Split('/')[(Post.Row.FindControl("postImage") as System.Web.UI.WebControls.Image).ImageUrl.Split('/').Length - 1];
string imgImage2 = (Post.Row.FindControl("userImage") as System.Web.UI.WebControls.Image).ImageUrl.Split('/')[(Post.Row.FindControl("userImage") as System.Web.UI.WebControls.Image).ImageUrl.Split('/').Length - 1];
// string Shimg = (SharePost.Row.FindControl("sharimg") as System.Web.UI.WebControls.Image).ImageUrl.Split('/')[(Post.Row.FindControl("shareimg") as System.Web.UI.WebControls.Image).ImageUrl.Split('/').Length - 1];
string FRIDeimg2 = (SharePost.Row.FindControl("friIMAGE") as System.Web.UI.WebControls.Image).ImageUrl.Split('/')[(Post.Row.FindControl("friIMAGE") as System.Web.UI.WebControls.Image).ImageUrl.Split('/').Length - 1];
string fname2 = (SharePost.Row.FindControl("lblfname") as Label).Text;
DateTime LbPostDate2 = Convert.ToDateTime((Post.Row.FindControl("lbldate") as Label).Text);
string LabDate2 = (Post.Row.FindControl("nulldate") as Label).Text;
string contentpost2 = (Post.Row.FindControl("LabeContent") as Label).Text;
string shContent2 = (Post.Row.FindControl("lblpost") as Label).Text;
string path02 = (Post.Row.FindControl("lblPATH2") as Label).Text;
string path42 = (Post.Row.FindControl("lblPATH") as Label).Text;
string imgeupload2 = (Post.Row.FindControl("lblimageupload") as Label).Text;
InsertDatabase2(userName2, fuserName2, contentPost2, modelId2, comment2, img2, imgpostImage2, imgImage2, contentpost2,
FRIDeimg2, fname2, LbPostDate2, shContent2, path42, path02, LabDate2, imgeupload2);
sb.Append(@"<script type='text/javascript'>");
sb.Append("$(function () {");
sb.Append(" $('#myModal9t').modal('hide');});");
sb.Append("</script>");
ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "ModelScript", sb.ToString(), false);
}
private void InsertDatabase2(string userName2, string fuserName2, string contentPost2, string modelId2, string
comment2, string img2, string imgpostImage2, string imgImage2, string contentpost2, string FRIDeimg2, string fname2,
DateTime LbPostDate2, string shContent2, string path42, string path02, string LabDate2, string imgeupload2)
{
using (SqlConnection con = new SqlConnection(constrr))
{
using (SqlCommand cmd = new SqlCommand("INSERT INTO USERPost VALUES(@UserName,@FriendUserName,@fName,
@Content,@Id,@TodayDate,@PostDate,@Comments,@FImageName,@ShImageName,@ContentPost,@SendDate,@ImageName1,@TotalCount,@Path,@ShPath)", con))
{
// cmd.Parameters.AddWithValue("@sId", modelId);
cmd.Parameters.AddWithValue("@UserName", Session["userName"]);
cmd.Parameters.AddWithValue("@FriendUserName", userName2);
cmd.Parameters.AddWithValue("@fName", fname2);
cmd.Parameters.AddWithValue("@Content", shContent2);
cmd.Parameters.AddWithValue("@Id", modelId2);
cmd.Parameters.AddWithValue("@TodayDate", LabDate2);
cmd.Parameters.AddWithValue("@PostDate", LbPostDate2);
cmd.Parameters.AddWithValue("@Comments", comment2);
cmd.Parameters.AddWithValue("@FImageName", imgImage2);
cmd.Parameters.AddWithValue("@ShImageName", imgpostImage2);
cmd.Parameters.AddWithValue("@ContentPost", contentpost2);
cmd.Parameters.AddWithValue("@SendDate", DateTime.Now);
cmd.Parameters.AddWithValue("@ImageName1", imgeupload2);
cmd.Parameters.AddWithValue("@TotalCount", 1);
cmd.Parameters.AddWithValue("@Path", path02);
cmd.Parameters.AddWithValue("@ShPath", path42);
con.Open();
cmd.ExecuteNonQuery();
con.Close();
// Response.Redirect("Home.aspx");
string message = "Post Passed successfully.";
string script = "window.onload = function(){ alert('";
script += message;
script += "')};";
Page.ClientScript.RegisterStartupScript(this.GetType(), "SuccessMessage", script, true);
}
}
this.Populatebooks();
}