I have a datagrid of 10 rows and I am updating the fifth
row using template column edit. How wil u know that the row
is updated, so that it can be send to database for updating
the respective table?

Answer Posted / jatinder walia

TestPage.aspx
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
<script language="javascript" type="text/javascript">
function Edit(TargetRow)
{
var txt =document.getElementById
(TargetRow.id).innerText;
AsyncHit("ProcesssPage.aspx?"+txt)
}

function AsyncHit(RemoteUrl)
{
var ParamString="xx";
if (window.XMLHttpRequest)
{ // For Firefox,Mozilla, Safari & IE 7 and above
etc
xmlhttp=new XMLHttpRequest();
}
else if (window.ActiveXObject)
{ //For IE
xmlhttp=new ActiveXObject('Microsoft.XMLHTTP');
}

if (typeof(xmlhttp)=='object')
{
xmlhttp.onreadystatechange=GetResponse;
xmlhttp.open('POST', RemoteUrl, true);
document.getElementById
("prg_bar").innerHTML="<img src='../images/ajax-
loader1.gif'/>";
xmlhttp.send(ParamString);
}
}


function GetResponse()
{
if (xmlhttp.readyState==4)
{
document.getElementById("prg_bar").innerHTML="*";
if (xmlhttp.status==200)
{
HandleResponse(xmlhttp.responseText);
}
else
{
HandleResponse("-1");
}
}
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:GridView ID="GridView1" runat="server"
OnRowCreated="GridView1_RowCreated">
</asp:GridView>

</div>
</form>
</body>
</html>
-----------------------------------------------------------
TestPage.aspx.cs
protected void Page_Load(object sender, EventArgs e)
{
ViewState.Add("shape", "circle");
string shapes = ViewState["shape"].ToString();
Application["a"] = "zzz";


}
protected void GridView1_RowCreated(object sender,
GridViewRowEventArgs e)
{
GridView1.Rows[RowCount].Attributes.Add("Row_" +
RowCount.ToString(), " onclick=javascript:Edit(this)");
RowCount++;
}

Is This Answer Correct ?    2 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are validators and list some validators of asp.net?

535


What is different in .net 1.1 and .net 2.0?

572


What are the types of authentication in asp.net?

547


benefits of migration from asp to asp.net hi frnds, i have to give presentation to a client about how useful would be migrating their project from asp to asp.net .plz give me some points which i should incorporate in my ppt thanks

1668


What are the elements of a website?

513






What is the difference between client-side and server-side validations in ASP.NET?

656


What is a runtime version?

522


What is the difference between stored procedure vs function?

571


Which is the parent class of the ASP.NET server control?

536


List the asp.net validation controls?

521


What is a global postback url?

507


Which .NET framework supports Web API?

586


Whats the difference between abstract factory pattern and factory pattern?

595


Dataset is the disconnected environment. suppose if you are binding records to gridview (disconnected environment) and you are making changes to the the grid but before updating the database if any other user modify the data, how will you avoid such problem?

1715


Differentiate between file-based dependency and key-based dependency.

508