protected void btnSharenow_Click(object sender, EventArgs e)
{
string modelId = (SharePost.Row.FindControl("lblModalId") as Label).Text;
string userName = (SharePost.Row.FindControl("lblUserName") as Label).Text;
string fuserName = (SharePost.Row.FindControl("lblfUserName") as Label).Text;
string contentPost = (SharePost.Row.FindControl("lblpost") as Label).Text;
string comment = (SharePost.Row.FindControl("txtcommentshare") as TextBox).Text;
string img = (SharePost.Row.FindControl("img") as Image).;
Also i need to insert these correctly but i dont know how to do that
private void InsertDatabase(string userName, string fuserName, string contentPost, DateTime sendDate, string modelId, string comment)
{
using (SqlConnection con = new SqlConnection(constrr))
{
using (SqlCommand cmd = new SqlCommand("INSERT INTO USERPost VALUES(@UserName,@FriendUserName,@ContentPost,,@ImageName1,@SendDate,@ShareId,@Comments,@FriendImageName,@null,@null)", con))
{
// cmd.Parameters.AddWithValue("@ShareId", modelId);
cmd.Parameters.AddWithValue("@UserName", username = this.Page.User.Identity.Name);
cmd.Parameters.AddWithValue("@FriendUserName", fuserName);
cmd.Parameters.AddWithValue("@ContentPost", contentPost);
cmd.Parameters.AddWithValue("@SendDate", sendDate);
cmd.Parameters.AddWithValue("@ShareId", modelId);
cmd.Parameters.AddWithValue("@Comments", comment);
cmd.Parameters.AddWithValue("@FriendImageName", img2);
cmd.Parameters.AddWithValue("@TotalCount", );
cmd.Parameters.AddWithValue("@ADStatus", );
cmd.Parameters.AddWithValue("@ImageName1", umg);
con.Open();
cmd.ExecuteNonQuery();
con.Close();
}
}