cnd
cnd

Reputation: 33784

ObjectDataSource Update/Delete parameters from GridView

<asp:ObjectDataSource ID="MMBRSODS" runat="server" 
OldValuesParameterFormatString="original_{0}" 
TypeName="Flow_WEB_Nemerle.SQLModule"
SelectMethod="GetMembers"
UpdateMethod="UpdateMember"
 DeleteMethod="DeleteMember"> 
 <UpdateParameters>
    <asp:Parameter Name="UserName" Type="String" />
 </UpdateParameters>
<DeleteParameters>
    <asp:Parameter Name="UserName" Type="String" />
</DeleteParameters>
</asp:ObjectDataSource>

Select method returns array of strings . But How I need to appear selected node for edit delete methods get this string (userName) ?

for methods like :

[DataObjectMethod(DataObjectMethodType.Delete, true)]
static public DeleteMember(...

Upvotes: 3

Views: 4063

Answers (1)

Brian Mains
Brian Mains

Reputation: 50728

What are you binding the original list against? Let's say you are binding a list; you can always do the following to do that type of operation:

MMBRSODS.UpdateParameters["UserName"].DefaultValue = list.SelectedValue;
MMBRSODS.Update();

So supplying the default value allows you to still use the update, the param relies on this default and supplies it to the backend... what control are you using to show the data?

HTH.

Upvotes: 2

Related Questions