TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Praveen Venugopal
NA
127
76.4k
how to refresh my web page using java script
Sep 10 2008 6:00 AM
Hello Mate,
I just want to know how can i refresh my page using java script. actually i have a datagrid in my web page(C#).
in that datagrid i have two columns on to display products name and another one is to display an image of "Delete" icon.
if i click a particular row ,that row got deleted. but when i try to save the products name from the datagrid to the database, it still has the same values. the product which i deleted using javascript is also included in the datagrid items.
Could You please help me on this?
my code is,
jscript function:
function Delete(obj,dg)
{
var DG1 = document.getElementById(dg);
if(obj!=null)
{
var par=obj.parentNode;
while(par.nodeName.toLowerCase()!='tr')
{
par=par.parentNode;
}
var param = par.rowIndex;
DG1.deleteRow(param);
return true;
}
return false;
}
Code behind:
if (Grid1.Items.Count != 0)
{
for (int cnt = 0; cnt < Grid1.Items.Count-1; cnt++)
{
object[] Parameters2 = new object[7];
Parameters2[0] = ddlProj_name.SelectedValue;
Parameters2[1] = txtEvt_title.Text;
Parameters2[2] = Grid1.Items[cnt].Cells[0].Text;
Parameters2[3] = Current_User;
Parameters2[4] = Current_Time;
Parameters2[5] = Current_User;
Parameters2[6] = Current_Time;
dbobj3.ExecuteNonQuery("INS_PRODUCTS", Parameters2);
}
}
protected void Grid1_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
if (!(e.Item.Cells[0].Text == "PRODUCTS"))
{
if (((e.Item.ItemType == ListItemType.Item)
|| (e.Item.ItemType == ListItemType.AlternatingItem)))
{
e.Item.Cells[1].Attributes.Add("style", "cursor:hand");
ImageButton img = new ImageButton();
img.ImageUrl = "../images/Remove.gif" ;
e.Item.Cells[1].Controls.Add(img);
e.Item.Cells[1].Attributes.Add("onclick", "return Delete(this,'" + Grid1.ClientID + "');");
}
}
}
Thanks In Advance,
Reply
Answers (
2
)
Can it be possible
print aspx page