Dear friends, Please suggest me how can i select a specified DIV by using checkbox from control tool to insert data into database. For Example: I have two DIVs (ID of div is respectively divCont,divImg). In divCont we have to insert text, divImg for image.I don't have to update an image, only text have to update.At that time we need to select a specific div to update in database. Regards, Pradeep
|
| Author: Raju.M 28 Aug 2008 | Member Level: Gold | Rating: Points: 6 |
this is not actual code coz i have no vs2005 or other editing tool with me. this is a logic u can try or message me
use ajax. <script lang='js' type='txt/js'> function X() { if(document.getElementById("raju").checked==true) { var divCont=document.getElementById("myDIv").innerHTML; AjaxRequest(divCont); }
}
function AjaxRequest(insertvalue) { var Req; try{Req=new XMLHttpRequest();}catch (e){try{Req=new ActiveXObject("Msxml2.XMLHTTP");}catch (e){try{xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}catch (e){alert("Your browser does not support AJAX!");return false;}}} Req.onreadystatechange=function() { if(Req.readyState==4) { var d=document.getElementById("myDiv"); if(d.innerHTML=="") {d.innerHTML+=Req.responseText;} else {d.innerHTML="";d.innerHTML+=Req.responseText;} } } Req.open("GET","InsertHandler.ashx?insertString="+insertvalue,true); Req.send(null); }
//************************ ///in HanderFile //********************************** if(context.Request.Querystring["insertString"]!=null) { //u can call class file or .dll to insert //after insert context.response.write("Updated");
}
thank oyu raju.m http://www.makhaai.blogspot.com
|
| Author: Palanivel 10 Oct 2008 | Member Level: Silver | Rating: Points: 5 |
****Javascrip Code for Update Text *************
documet.getElementById(divCont).innerText = "<your text>" documet.getElementById(divImg).innerText = "<your image text>"
but the draw back is whatever the text you written that will display in browse. to avoid that you have to use the following method
****Javascrip Code for Update HTML************* var strPath ="<path of the image>"; documet.getElementById(divCont).innerHTML = "<your text>" documet.getElementById(divImg).innerHTML = "<img src="+strPath+">"
|