|
-
Sep 9th, 2004, 02:41 PM
#1
Thread Starter
Lively Member
ASP.NET Datagrid Button not working
I have an ASP.NET application that takes a couple of small strings from an SQL database and puts them into a datagrid. This part is working fine. However, I added a button at the end of the grid that, when the user clicks it, will get the ID of the row he/she clicked and display more information about that particular row. According to the help, I should be able to add a value in the "Command name" box of the datagrid's columns Collection and then a ItemCommand event that responds to the click of the button. I added the Command name "Read" to the datagrid's columns collection for that button. However, nothing seems to be happening. The page appears to be updating, but nothing actually happens. I put a label on the form called lblTest and a regular button called btnTest on the page and wrote the following code:
Code:
Private Sub btnTest_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTest.Click
lblTest.Text = "Hey"
End Sub
Private Sub dgMail_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles dgMail.ItemCommand
lblTest.Text = "Hey"
End Sub
The regular button works but the button embedded in the datagrid (dgMail) doesn't. I'm not even trying to get into what row got clicked yet, just trying to evoke some kind of response. Any ideas?
I should point out that I am not a native ASP programmer. I've done a few pages, but mostly I'm a VB.NET programmer.
Joe Cody
Data Integration Engineer
Novaspect, Inc.
Elk Grove Village, IL
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|