-2

I really need some help..! I have several forms & several reports in a windows (.aspx) app that I created. The forms have an option to pull data from an outside db, once done, they can edit the form & then click the submit button to save to 1 of the 5 tables I created in SQL. My problem is, we are getting a bunch of duplicate records. There should be 1 row of data (record) per call #.

I have searched & searched & what I found to be the best (with consideration of the user's needs) is if I could have the 'edit' button in the report gridview to redirect to the form page (already created as an input form), only have a couple items changed (such as instead of the submit, to hid that button & enable a 'update' button, IN ADDITION to the form prepopulating with the data (IF any) that's in the table corresponding with that form & report. Although I have created several applications, I am new to hard coding & so 'detailed' guidance is requested. I will GREATLY appreciate any help! This application needs deployed asap so I am really stressing on this one..

Needing Help Desperately..

Kathy

Kathy
  • 25
  • 1
  • 1
  • 2

1 Answers1

0

It's actually better to use select and here's why:

Protected Sub MyGridView_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs) Handles MyGridView.SelectedIndexChanged
    Dim formid As String = gvRequisitonLines.DataKeys(gvRequisitonLines.SelectedRow).Value.ToString()
    Reponse.Redirect("~/FormPage.aspx?formid=" & formid)
End Sub

This allows you to get the selected index extremely easily and use it to get the DataKey which you can send as a QueryString parameter to your form page.

Of course this requires that you have your form identifier set as a datakey on the GridView.

So for clarity, your button would have the text "Edit" but the command "Select".

Doug Morrow
  • 1,306
  • 1
  • 10
  • 18
  • As of now, there really isn't any code behind the gridview. It's a basic gridview w/ edit enabled. I would like to change that edit from opening a specific line of data to edit to opening a form which prepopulates the available data to edit & save. – Kathy Aug 20 '13 at 17:01