Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

asp.net 4 gridview update parameters how to create

Status
Not open for further replies.

DougP

MIS
Dec 13, 1999
5,985
US
I have a gridview and I clicked the Update tab in the properties dialog box.
I created a SQL string and specified @parameters for every column in the gird.
When I view the page in a browser it shows "Edit" on the left when I click it the grid changes adn lets me edit any field. I choose a field and change the value then when I hit the "Update" link butotn notihoogn hapend the grid flickers a bit but it doe not change anything. I am usre the @parameters need to point back to the grid somehow bu I can't see where to do that.
Example: the Select tab in the giridview let you specify a cookei or control or seesion variabel as wher to get the @parameters but the update has no such option.
I could do it manually in the source but I don't know how to specify what to use.
like Gridview1.TheColumn
Code:
<UpdateParameters>
            <asp:Parameter ControlID="?????" Name="FirstName" />
            <asp:Parameter ControlID="?????" Name="LastName" />
...
</UpdateParameters>
in the Select paramters I see this which is what I choose in the Configure data spource Wizard
        <SelectParameters>
            <asp:ControlParameter [COLOR=red]ControlID="txtWeekEndingDate"[/color] Name="WeekEndDate" 
                PropertyName="Text" Type="DateTime" />
            <asp:SessionParameter Name="Firstname" [COLOR=red]SessionField="UserFirstname"[/color]  />
            <asp:SessionParameter Name="Lastname" [COLOR=red]SessionField="UserLastname"[/color]  />
        </SelectParameters>
Any ideas?

TIA

DougP
 
This is why I don't use the datasource controls. They are useful for very simplistic queries.
My suggestion is to write the sql yourself, preferably, create a DAL, or use Microsoft's Data Access Block in their Enterprise Library.

If you are dead set on using the datasource control, I guess you would have to set the parameters in one of the grid events, perhaps the RowDataBound event?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top