jvcoach23 Posted November 6, 2003 Posted November 6, 2003 (edited) I'm using a datagrid, dataadapter (with an existing stored procedures going to sql 2000) and a dataset (untyped). I'm doing things on this web form same as a couple of other pages but without success. I'm using a series of drop down list to build the parameter values for the stored procedure. In the datagrid, I've used the properties builder so that I can have an EDIT link show up to edit the data. When I click on EDIT, it shoudl bring up the UPDATE and CANCEL commands. When I run the page, the drop down list populate the stored procedure parms and the sp fires and populates the dataadapter and shows up in the grid. When I click on the edit button, All the data I has goes away and I have only a blank row. If I click on cancel, then the data (there is only 1 row right now) shows back up. I haven't written the update stored procedure yet but I will once I can get past this. Here is some of the code. 'This is the last drop down and I have all the parms info I need Private Sub dtmStart_SelectionChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles dtmStart.SelectionChanged Me.lblDateChosen.Visible = True Me.txtdtmStart.Visible = True Me.txtdtmStart.Text = Me.dtmStart.SelectedDate Me.cmdRequestDayOnOff.Visible = True 'I'm shoving the values into the parms of the sp With Me.spListRequestWorkOff .Parameters("@intTblEmployeeId").Value = Me.ddlEmployeeList.SelectedItem.Value .Parameters("@intTblInstitutionId").Value = Me.ddlInstitution.SelectedItem.Value .Parameters("@startdate").Value = Me.dtmStart.SelectedDate .Parameters("@enddate").Value = Me.dtmStart.SelectedDate End With Me.grdListRequestWorkOff.Visible = True bindgrid() End Sub #Region "Data Grid Section" Sub bindgrid() Me.daListRequestWorkOff.Fill(Me.dsListRequestWorkOff) With Me.grdListRequestWorkOff .DataSource = Me.dsListRequestWorkOff .DataKeyField = "intTblRequestId" .DataBind() End With End Sub Private Sub grdListRequestWorkOff_EditCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles grdListRequestWorkOff.EditCommand Me.grdListRequestWorkOff.EditItemIndex = e.Item.ItemIndex bindgrid() End Sub Private Sub grdListRequestWorkOff_CancelCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles grdListRequestWorkOff.CancelCommand Me.grdListRequestWorkOff.EditItemIndex = -1 bindgrid() End Sub any help would be great.. I've looked and the other grids that I'm doing this with are following the same plan as this, however this is the only one where there are parms with the stored procedure. thanks shannon Edited November 6, 2003 by Robby Quote JvCoach23 VB.Net newbie MS Sql Vet
jvcoach23 Posted November 6, 2003 Author Posted November 6, 2003 Or, if you can tell me how to not have to use the edit button and let them change info in the grid and have the grid automatically call an update stored procedure.. that would be great too. Quote JvCoach23 VB.Net newbie MS Sql Vet
Moderators Robby Posted November 6, 2003 Moderators Posted November 6, 2003 Is bindgrid() also called from the form load event and is it in a Not IsPostBack condition? Quote Visit...Bassic Software
jvcoach23 Posted November 7, 2003 Author Posted November 7, 2003 Yes I believe so.. here it is Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'Put user code to initialize the page here If Not Page.IsPostBack Then With Me.ddlInstitution Me.daInstitutionList.Fill(Me.dsInstitutionList) .DataSource = Me.dsInstitutionList .DataTextField = "vcInstitutionName" .DataValueField = "intTblInstitutionId" .DataBind() ' .Items.Insert(0, "Select an Institution") bindgrid() End With End If End Sub Quote JvCoach23 VB.Net newbie MS Sql Vet
jvcoach23 Posted November 17, 2003 Author Posted November 17, 2003 I've been working on this problem on and off.. more off than on.. was wondering if anyone had any insight as to why the edit doesn't seem to be working Quote JvCoach23 VB.Net newbie MS Sql Vet
jvcoach23 Posted November 19, 2003 Author Posted November 19, 2003 I grabbed the sql being sent to the server using profiler. It looks like when the grid is populated it fires the stored procedure off to the server with the paramters filled incorrectly. when I click on edit, it fires again, but this time all the parms being passed into the stored procedure are set to default so I'm not getting the information to the grid when I click on edit. can someone tell me what I'm doing wrong in teh code above that it wouldn't send the parmater information correctly. Of am I missing something.. thanks shannon Quote JvCoach23 VB.Net newbie MS Sql Vet
jvcoach23 Posted November 19, 2003 Author Posted November 19, 2003 forgot to add that I also moved the bindgrid out of the with statement.. it's still in the if not postback section though Quote JvCoach23 VB.Net newbie MS Sql Vet
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.