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.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 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;
-
-
-
- },
- error:function(error)
- {
- var r = error.responseText;
- var errorMessage = r.Message;
- alert(errorMessage);
- alert(r);
- alert("error");
-
- }
-
- });
- };
-
-
- </script>
but this is also not working