LadyReader1
Member
- Joined
- Apr 11, 2007
- Messages
- 10
- Programming Experience
- 10+
2 problems, maybe related (VB.net 2005):
I have a GridView with 7 columns, 2 of which are set to not Visible. One of these is a unique identifier for the row's record and the other is a non-unique identifier for the batch the item falls into (there can be multiple rows per batch and multiple batches displayed in this GridView). Originally I also had a "Delete" button, which worked fine. Then I added another command button for "Select". The data is being retrieved thru a SQLDataSource using sprocs.
I am using the RowCommand event to test for e.CommandName. Initially, while developing, I set Visible=True for both the Unique_ID and the Batch_ID columns and I was able to retrieve the value of Batch_ID with:
and the Select command was able to be processed. But when I reset the Batch_ID column to not Visible, the reference came up as an empty string. Question 1: why is this value unavailable when the column is not visible?
I added Batch_ID to the list of DataKeys, along with the unique row identifier, and then I was able to retrieve Batch_ID with:
This gave me what I wanted but then I retested the Delete functionality and that failed, telling me I had too many arguments for the sproc. Question 2: Is this related to the fact that I have multiple items specified in the DataKey collection? How do I get around this?
Also, I need to be able to intercept the Delete process so I can test to see if the SQL record has any child records. If it does, I want to cancel the delete, so I can't allow the SQLDataSource to handle the Delete by itself. Question 3: do I need to stop using the SQLDataSource and just code it myself?
Thank you for any help you can offer.
I have a GridView with 7 columns, 2 of which are set to not Visible. One of these is a unique identifier for the row's record and the other is a non-unique identifier for the batch the item falls into (there can be multiple rows per batch and multiple batches displayed in this GridView). Originally I also had a "Delete" button, which worked fine. Then I added another command button for "Select". The data is being retrieved thru a SQLDataSource using sprocs.
I am using the RowCommand event to test for e.CommandName. Initially, while developing, I set Visible=True for both the Unique_ID and the Batch_ID columns and I was able to retrieve the value of Batch_ID with:
VB.NET:
MyGridView.Rows(e.CommandArgument).Cells(1).Text
and the Select command was able to be processed. But when I reset the Batch_ID column to not Visible, the reference came up as an empty string. Question 1: why is this value unavailable when the column is not visible?
I added Batch_ID to the list of DataKeys, along with the unique row identifier, and then I was able to retrieve Batch_ID with:
VB.NET:
MyGridView.DataKeys.Item(e.CommandArgument).Values(1)
This gave me what I wanted but then I retested the Delete functionality and that failed, telling me I had too many arguments for the sproc. Question 2: Is this related to the fact that I have multiple items specified in the DataKey collection? How do I get around this?
Also, I need to be able to intercept the Delete process so I can test to see if the SQL record has any child records. If it does, I want to cancel the delete, so I can't allow the SQLDataSource to handle the Delete by itself. Question 3: do I need to stop using the SQLDataSource and just code it myself?
Thank you for any help you can offer.