Hi all, I have a datafunction that selects content from a database to be inserted into the gridview. I have another datafunction that will delete a row from the gridveiw. This datafunction required a parameter. The parameter is not saved into the gridview. This is where my problem begins..... Is there any way of getting the parameter required, saved somewhere, so that when i come to delete a row, i can get it into the function below: protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Delete") { //GET PARAMETER HERE... } } Code (markup): Im using an ObjectDataSource, which is configured to a business object. I have a data function selected for the SELECT and DELETE methods. The datafunction are not saved in the database, they are located within the App_Code folder. SELECT method - GetAll(int userid) DELETE method- Delete(int userid, intStockid) Therefore it is the function parameters that im having trouble getting into the DELETE method. I managed to get the parameter required for the select method using the following line of code in the page_load ObjectDataSource1.SelectParameters["UserID"].DefaultValue = userID.ToString(); Code (markup): However, I cant seem to get the function parameters needed for the delete method when any of the delete buttons from the gridview are clicked. Idealy, i would like to have a hiddern field in the gridview that could hold the StockID. When the delete button is clicked, I could receive the StockID into the GridView1_RowCommand function, and manually delete the row required (by calling DataFunction.Delete(userid, StockID) inside the RowCommand function. Many thanks in advanced, this problem has been causing me no ends of trouble. Any help would be much appreciated
FindControl - DirectCast as hiddenfield or Whatever kind of control you want. That's all you need to know to modify any of the .NET controls or iterate through each item on page pre-render. iterate over each row, then findcontrols in the column of each row