views:

26

answers:

1

Hello

I have the following repeater code:

 <asp:Repeater ID="repMain" runat="server" OnItemCommand="repMain_ItemCommand" EnableViewState="false">
    <ItemTemplate>
    <dmg:testcontrol runat="server" MyData=<%#Container.DataItem %>>


    </dmg:testcontrol>
    </ItemTemplate>
    </asp:Repeater>

The testcontrol usercontrol looks like:

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="TestControl.ascx.cs" Inherits="TestRepeater.TestControl" %>
<asp:Literal runat="server" ID="litMain" Text="<%#MyData.MyValue %>"></asp:Literal>
<asp:DropDownList runat="server" ID="dropdownMain"></asp:DropDownList>
<asp:Button runat="server" ID="btnMain" Text="Click Me" CommandName="Update" CommandArgument="<%#dropdownMain.SelectedValue%>"/>

Is it possible for me to send through the dropdownMain.SelectedValue as the CommandArgument?

Just now it is an empty string.

Thanks

Duncan

PS This is related to http://stackoverflow.com/questions/4054587/asp-net-repeater-not-binding-after-itemcommand but I thought the two sufficiently different to keep apart.

A: 

Why not get the selected value, and use it inside the Command function ?

(why to try to send it as argument, from the moment you can get it inside the command called function and its the same)

Aristos