Temujin
asked on
Code works in VS2003 but not in VS2005
Hello:
I have an aspx page in Visual Studio 2003 with a datagrid on it. I have the next code for highlighting the grid row when the mouse is over and then when the user clicks on the row it takes a copule of parameters (IdArea, AreaName) and redirects the browser to another aspx page.
This code works very well in VS2003 but I recently migrated this project to VS2005 and it does not work anymore, I tried to make it work but it seems I can't do it. What is happening (I suppose) is that the DataGrid1_SelectedIndexCha nged event is not firing when the user clicks on the datagrid row so I have a page postback but no redirection at all.
Does anyone has any idea why this code stopped working ??
I would appreciate any help in this matter.
Thank you
Temujin
CODE:
Private Sub DataGrid1_SelectedIndexCha nged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DataGrid1.SelectedIndexCha nged
DataGrid1.SelectedItem.Att ributes.It em("onmous eover") = "this.style.cursor='hand'"
DataGrid1.SelectedItem.Att ributes.Re move("onmo useout")
'--Redirect to WebForm2
Dim url As String
url = "WebForm2.aspx?IdArea=" + DataGrid1.SelectedItem.Cel ls(0).Text + "&AreaName=" + DataGrid1.SelectedItem.Cel ls(1).Text
Response.Redirect(url)
End Sub
Private Sub DataGrid1_ItemCreated(ByVa l sender As Object, ByVal e As System.Web.UI.WebControls. DataGridIt emEventArg s) Handles DataGrid1.ItemCreated
If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingIt em Or e.Item.ItemType = ListItemType.SelectedItem Then
e.Item.Attributes.Add("onm ouseover", "this.style.backgroundColo r='#D8E4F8 ';this.sty le.cursor= 'hand'")
e.Item.Attributes.Add("onm ouseout", "this.style.backgroundColo r='white'; ")
e.Item.Attributes.Add("onc lick", "javascript:__doPostBack(' " & "DataGrid1:" & "_ctl" & (e.Item.ItemIndex + 3) & ":_ctl0','')")
End If
End Sub
I have an aspx page in Visual Studio 2003 with a datagrid on it. I have the next code for highlighting the grid row when the mouse is over and then when the user clicks on the row it takes a copule of parameters (IdArea, AreaName) and redirects the browser to another aspx page.
This code works very well in VS2003 but I recently migrated this project to VS2005 and it does not work anymore, I tried to make it work but it seems I can't do it. What is happening (I suppose) is that the DataGrid1_SelectedIndexCha
Does anyone has any idea why this code stopped working ??
I would appreciate any help in this matter.
Thank you
Temujin
CODE:
Private Sub DataGrid1_SelectedIndexCha
DataGrid1.SelectedItem.Att
DataGrid1.SelectedItem.Att
'--Redirect to WebForm2
Dim url As String
url = "WebForm2.aspx?IdArea=" + DataGrid1.SelectedItem.Cel
Response.Redirect(url)
End Sub
Private Sub DataGrid1_ItemCreated(ByVa
If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingIt
e.Item.Attributes.Add("onm
e.Item.Attributes.Add("onm
e.Item.Attributes.Add("onc
End If
End Sub
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Sorry for the delay, trip took longer than i tought.
I didn´t have any time to test your comments but i must close this question since it didn't raise any other comments, so i think you both are right.
Thank you guys.
Temujin
I didn´t have any time to test your comments but i must close this question since it didn't raise any other comments, so i think you both are right.
Thank you guys.
Temujin
ASKER
I'll be on a little work trip and I'll return on monday may, 15. I will retake this problem and i'll get back to you. I'll check your comments then.