Am trying to use model popup submit alert to display submittion successfull,so i commented out return message alert code and it gave me this error
[WebMethod]
public static string InsertCommenttype(string id, string name, string username, string contentpost, string senddate, string comments, string imageuser, string imagename1, string path)
{
string constr = ConfigurationManager.ConnectionStrings["DB"].ConnectionString;
using (SqlConnection con = new SqlConnection(constr))
{
using (SqlCommand cmd = new SqlCommand("INSERT INTO [POSTS](UserName,fName,Content,ID,PostDate,Comments,FImageName,ImageName,TotalCount,Path) VALUES(@UserName,@fName,@Content,@ID,@PostDate,@Comments,@FImageName,@ImageName,@TotalCount,@Path)"))
{
cmd.Connection = con;
cmd.CommandType = CommandType.Text;
// cmd.Parameters.AddWithValue("@ID", id);
cmd.Parameters.AddWithValue("@UserName", HttpContext.Current.Session["userName"].ToString());
cmd.Parameters.AddWithValue("@fName", name);
cmd.Parameters.AddWithValue("@Content", contentpost);
cmd.Parameters.AddWithValue("@PostDate", senddate);
cmd.Parameters.AddWithValue("@ID", id);
cmd.Parameters.AddWithValue("@Comments", comments);
cmd.Parameters.AddWithValue("@FImageName", imageuser);
cmd.Parameters.AddWithValue("@ImageName", imagename1);
cmd.Parameters.AddWithValue("@TotalCount", 1);
cmd.Parameters.AddWithValue("@Path", path);
con.Open();
cmd.ExecuteNonQuery();
con.Close();
}
}
return "Your Rehyped Submited";
}
ERROR
Server Error in '/' Application.
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS0161: 'Timeline.InsertCommenttype(string, string, string, string, string, string, string, string, string)': not all code paths return a value
Source Error:
Line 180: // Insert into Customer Choice Description Table
Line 181: [WebMethod]
Line 182: public static string InsertCommenttype(string id, string name, string username, string contentpost, string senddate, string comments, string imageuser, string imagename1, string path)
Line 183: {
<script type="text/javascript">
$(function () {
$('.btn').on('click', function () {
if ($(this).val().toLowerCase() == 'save') {
$("#lblText").html('Record saved successfully.');
}
else if ($(this).val().toLowerCase() == 'update') {
$("#lblText").html('Record updated successfully.');
}
else if ($(this).val().toLowerCase() == 'delete') {
$("#lblText").html('Record deleted successfully.');
}
$('#dialog').fadeIn('slow').delay(1000).fadeOut('slow');
});
});
</script>
<input id="btnSave" type="button" value="Save" class="btn" />
<input id="btnUpdate" type="button" value="Update" class="btn" />
<input id="btnDelete" type="button" value="Delete" class="btn" />
<div id="dialog" style="display: none; top: 0; left: 45%; position: fixed; background-color: Yellow;
height: 50px;border: solid;line-height: 45px;">
<span id="lblText" style="color: Green; top: 50px;"></span>
</div>