asp.net mvc + jEditable - save edited cell data in database
Date : March 29 2020, 07:55 AM
this will help First Question: Url.Content() should be used for serving static files ie JS or CSS like Url.Content("~/Scripts/jquery.js")
[HttpPost]
public ActionResult Edit()
{
string elementId = this.HttpContext.Request.Form["id"];
}
|
How to save only edited data that retrieved from database? i'm confused. I can delete specific record but can not save o
Date : March 29 2020, 07:55 AM
wish of those help The simplest solution is to move your existing tags to around the table row in the loop. That way you will be able to edit one row at a time without modifying your save page code. I have added the form tags to your code below, but you would need to use the FORM tag you are already using: <table cellpadding="0" cellspacing="0" border="1" width="100%">
<tr class="border bluebackend" >
<td class="center bold" width="30">Size</td>
<td class="center bold" width="30">Color</td>
<td class="center bold" width="27%">Est. Qty (dz.)</td>
<td class="center bold" width="30"> </td>
<td class="center bold" width="30"> </td>
</tr>
<%
dim total_qty_est, total_qty
if rsPdtn_sizeColor.eof then
response.Write "<tr><td colspan=""3"">file not found</td></tr>"
Else
Do while Not rsPdtn_sizeColor.EOF
total_qty_est = rsPdtn_sizeColor.fields.item("pdtn_st_qty_est")
total_qty = total_qty + total_qty_est
%>
<form action="" method=""><!--move your form open tag here-->
<tr >
<td class="center">
<select name="pdtn_st_size">
<option selected>-- size -- </option>
<option value="L" <%=checkSelectedScript(rsPdtn_sizeColor.fields.item("pdtn_st_size"),"L")%>>L</option>
<option value="XL" <%=checkSelectedScript(rsPdtn_sizeColor.fields.item("pdtn_st_size"),"XL")%>>XL</option>
</select>
</td>
<td class="center">
<select name="pdtn_st_color">
<option selected>-- color -- </option>
<option value="Orange" <%=checkSelectedScript(rsPdtn_sizeColor.fields.item("pdtn_st_color"),"Orange")%>>Orange</option>
<option value="Pink" <%=checkSelectedScript(rsPdtn_sizeColor.fields.item("pdtn_st_color"),"Pink")%>>Pink</option>
</select>
</td>
<td class="center">
<input type="text" value="<%=PcsToDz(rsPdtn_sizeColor.fields.item("pdtn_st_qty_est"))%>" name="pdtn_st_qty_est" size="3">
(<%=rsPdtn_sizeColor.fields.item("pdtn_st_qty_est")%>)
</td>
<td><input type="button" name="" value="Del" onClick="confirmationDeletePrice('../engine/delPdtn_szCl.asp?pdtn_szcl_id= <%=rsPdtn_sizeColor.fields.item("pdtn_szcl_id")%>&pdtn_st_id=<%=rsPdtn_sizeColor.fields.item("tbl_pdtn_sizecolor.pdtn_st_id")%>')"></td>
<td class="center" >
<input type="button" name="" value="Save" onClick="confirmationSaveProduction_Szcl('production_szcl_edit_action.asp?pdtn_szcl_id= <%=rsPdtn_sizeColor.fields.item("pdtn_szcl_id")%>')">
<input type="hidden" value="Y" name="edit_pdtn_szcl">
<input type="hidden" value="<%=rsPdtn_sizeColor.fields.item("pdtn_szcl_id")%>" name="pdtn_szcl_id">
</td>
</tr>
</form><!--move your form close tag here-->
<%
rsPdtn_sizeColor.movenext
Loop
rsPdtn_sizeColor.movefirst
end if
%>
|
Save edited cell/s from JTable to database
Tag : java , By : user143729
Date : March 29 2020, 07:55 AM
this will help Newbie to JTable. Just got in today. So I am able to populate my data from database into a JTable. I am currently stuck in saving the edited cell/s into the database. , use preparedstatement like this way for inserting into DB PreparedStatement pt=con.prepareStatement("insert into mytable values(?) ");
pt.setString(1,ID);
int result=pt.executeUpdate();
PreparedStatement pt=con.prepareStatement("update mytable set column_name=? ");
pt.setString(1,ID);
int result=pt.executeUpdate();
|
data not saving in database through jtable (Edited)
Tag : java , By : Ted Leung
Date : March 29 2020, 07:55 AM
around this issue You have ClassCastException because of your JTable store Integer values which can't be cast to String like next String column1= (String) jTable1.getValueAt(i,0);. Change that to: String column1= jTable1.getValueAt(i,0) == null ? "" : jTable1.getValueAt(i,0).toString();
|
How to save edited data from a table back to the database with jquery
Date : March 29 2020, 07:55 AM
it fixes the issue Here is what I came up with that works. I just use a php script to then save the data to the database. function saveNewRowData(){
shapeName = $("input[name=shapeName]").val();
numberEdges = $("input[name=numberEdges]").val();
sumAngles = $("input[name=sumAngles]").val();
$.ajax({
type: "POST",
url: "saveNewData.php",
data: {shapeName: shapeName, numberEdges: numberEdges, sumAngles: sumAngles},
success: function(response){
}
});
}
|