TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Naresh Bada
NA
212
18.9k
i entered @ in email in behind some value be inserting
Mar 11 2020 12:08 AM
please, anyone, help me I shared my code
view code:
@Html.Action("department")
@*create a pop up model*@
<div id="myModal" class="modal fade" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title"></h4>
</div>
<div class="modal-body">
<form id="form">
<fieldset id="SubmitForm">
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
@Html.HiddenFor(m => m.reg_id, new { @id = "reg_id" })
<div class="form-group">
@Html.TextBoxFor(m => m.reg_name, new { @id = "reg_name", @class = "form-control", @placeholder = "Enter Name*" })
@Html.ValidationMessageFor(m => m.reg_name, "", new { @class = "text-danger" })
</div>
<div class="form-group">
@Html.TextBoxFor(m => m.reg_email, new { @class = "form-control", @placeholder = "Enter Email*" })
@Html.ValidationMessageFor(m => m.reg_email)
</div>
<div class="form-group">
@Html.TextBoxFor(m => m.reg_mob, new { @id = "reg_mob", @class = "form-control", @placeholder = "Enter Mobileno*" })
@Html.ValidationMessageFor(m => m.reg_mob, "", new { @class = "text-danger" })
</div>
<div class="form-group">
@*@Html.EditorFor(m => m.dep_name)*@
@*@Html.LabelFor(model => model.dep_name, htmlAttributes: new { @class = "control-label " })*@
@Html.DropDownListFor(m => m.dep_name[0],(SelectList)ViewBag.listofdepartment1 as SelectList, new { @class = "form-control", @placeholder = "Department*" })
@*@Html.DropDownList("Statusitem", (IEnumerable<SelectListItem>)ViewBag.Statusitem, new { id = "dep_name", @class = "form-control" })*@
@Html.ValidationMessageFor(m => m.dep_name, "", new { @class = "text-danger" })
</div>
<div class="form-group">
@*<a href="" class="btn btn-block btn-danger" type="submit" id="Savedetails">Save</a>*@
<input type="submit" id="Savedetails" text="submit" value="Save" />
@*<input type="submit" id="Updatedetails" text="submit" value="Update" />*@
@Html.TextBoxFor(m => m.save_type, new { @id = "save_type", @class = "form-control", @placeholder = "Email*", @type = "hidden" })
</div>
controler code:
public JsonResult SaveDataInDatabase(string data, int type, Details details, string email)
{
string[] split_data = data.Split('&') ;
SqlConnection con = new SqlConnection(maincon);
string sqlquery = "";
string queryValidate = "Select * from reg_mast where reg_email='" + split_data[2].Split('=')[1].Replace('%', '@') + "' or reg_mob='" + split_data[3].Split('=')[1] + "'";
SqlDataAdapter da = new SqlDataAdapter(queryValidate, con);
da.Fill(dt);
if (dt.Rows.Count > 0)
{
Response.Write("This Mail Id already is there ...");
}
else
{
if (split_data[5].Split('=')[1] == "1")
{
sqlquery = "insert into reg_mast(reg_name,reg_email,reg_mob,dep_Id) values('" + split_data[1].Split('=')[1] + "','" + split_data[2].Split('=')[1].Replace('%', '@') + "','" + split_data[3].Split('=')[1] + "','" + split_data[4].Split('=')[1] + "')";
}
else
{
sqlquery = "update reg_mast set reg_name='" + split_data[1].Split('=')[1] + "',reg_email='" + split_data[2].Split('=')[1].Replace('%', '@') + "',reg_mob='" + split_data[3].Split('=')[1] + "',dep_Id='" + split_data[4].Split('=')[1] + "' where reg_id=" + split_data[0].Split('=')[1] + "";
}
cmd.CommandType = CommandType.Text;
cmd.CommandText = sqlquery;
cmd.Connection = con;
if (con.State == ConnectionState.Open)
{
con.Close();
}
con.Open();
dr = cmd.ExecuteReader();
dt.Load(dr);
ModelState.Clear();
}
return Json("true");
}
Attachment:
Capture122.rar
Reply
Answers (
0
)
Google maps show current location and state?
How to make access of crystal report used by Admin