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
What is connection pooling and how to enable and disable connection pooling?
When cookie will expire?
Why is asp.net so popular?
What are asp.net web forms?
What are the advantages of using sql stored procedures instead of adhoc sql queries in an asp.net web application?
What is skin in asp.net?
How you can manage the state of application at the server side in ASP.NET?
Explain what is event bubbling?
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?
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
What is session object? Describe in detail.
What is a page life cycle?
Which validator control you use if you need to make sure the values in two different controls matched?
Write some code using interfaces, virtual methods, and an abstract class`
What is viewstate parameter?