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 is connection pooling and how to enable and disable connection pooling?

478


When cookie will expire?

580


Why is asp.net so popular?

509


What are asp.net web forms?

520


What are the advantages of using sql stored procedures instead of adhoc sql queries in an asp.net web application?

578






What is skin in asp.net?

518


How you can manage the state of application at the server side in ASP.NET?

575


Explain what is event bubbling?

575


i have 3+ exp in .net? i am going interview now but they asked me do you know any TOOL? which tool will i study please refer me?

1838


What is the recommended approach for asp.net mvc to globally intercept exceptions? What other functionality can be implemented with the approach? : Asp.Net MVC

496


What is session object? Describe in detail.

560


What is a page life cycle?

567


Which validator control you use if you need to make sure the values in two different controls matched?

647


Write some code using interfaces, virtual methods, and an abstract class`

1577


What is viewstate parameter?

520