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
scropio gurl
NA
147
99.2k
Insert label value in table
Oct 24 2016 5:20 AM
There is dropdown in abc page and values
323r
244f
and there is button and table
TID TTID
1 323r
2 244f
so when i select value from dropdown and click on button then value is save in table
and after this there is def page
in that there is label i save dropdown selected value in label
there is another table 2
in that
id TTID value3
1 323r 234
2 323r 456
so i want when i click on button which is def page want to save label value in TTID column in table 2
for this i try this in linq
protected
void
Button2_Click(object sender, EventArgs e)
{
string
TTID
=
""
;
tbl_fl_schedule
ss =
new
tbl_fl_schedule
();
Data t =
new
Data();
ss.
TTID
=
TTID
;
{
ss.
TTID
= HttpContext.Current.Session[
"Vechilevalue"
].ToString();
}
t.tbl_fl_schedule.Add(ss).ToString();
t.SaveChanges();
}
and this show an error
System.Data.Entity.Validation.DbEntityValidationException: Validation failed for one or more entities. See 'EntityValidationErrors' property for more details.
i want to do this through jquery
i try this
public
static
void
insertservies(string Vechile_ID)
{
tbl_fl_schedule
ss =
new
tbl_fl_schedule
();
Data t =
new
Data();
ss.
TTID
=
TTID
;
{
//ss.Vechile_ID=
ss.
TTID
= HttpContext.Current.Session[
"Vechilevalue"
].ToString() ;
}
t.tbl_fl_Services_schedule.Add(ss).ToString();
t.SaveChanges();
}
<script type=
"text/javascript"
>
$(function () {
debugger;
$(
'[ID*=btnadd]'
).on(
'click'
, function () {
var
TTID
=
'<%=Session["Vechilevalue"]%>'
;
//var Frequency = $('#txt_repeat').val();
var obj = {};
obj.
TTID
=
TTID
;
get(obj);
});
});
function get(obj) {
debugger;
var ins = {};
ins.Vechile_ID = obj.Vechile_ID;
$.ajax({
type:
"POST"
,
url:
"Maintenance.aspx/insertservies"
,
contentType:
"application/json;charset=utf-8"
,
data:JSON.stringify(ins),
dataType:
"json"
,
success: function (result) {
debugger;
//("#Label1") = obj.Vechile_ID;
// $("#Label1" + obj.Vechile_ID).html(ins.Vechile_ID);
},
error:function(error)
{
var r = error.responseText;
var errorMessage = r.Message;
alert(errorMessage);
alert(r);
alert(
"error"
);
}
});
};
</script>
but this is also not working
Reply
Answers (
1
)
how to make Jquery dropdownlist with button
ASP.NET MVC using jquery