views:

25

answers:

1

hi guys, I have a datalist.My designer code is like this.

<asp:DataList ID="dlView" runat="server" CssClass="basix" RepeatColumns="4" >
<ItemTemplate>
<tr>
<td>  
<asp:Image ID="imgPlan" runat="server" ImageUrl='<%#GetImage(Eval("ImageName")) %>' />
</td>
<td>  
<asp:LinkButton ID="lnkChangeLogo" runat="server"  Text="ChangeLogo" CommandName="Select">
      </asp:LinkButton>&nbsp;

   <asp:LinkButton ID="lnkRemoveLogo" runat="server" Text="RemoveLogo"       
    OnClientClick="javascript:ConfirmChoice();return false;"/>
    </td>    
 <td>   
        <asp:FileUpload ID="FileUpload1" runat="server" /> 
        <asp:Button ID="btnUpload" runat="server" Text="Upload"/>
 </td>

</tr>


</ItemTemplate>
</asp:DataList>

when i click btnUpload ,I want to call one function in javascript ,suppose its uploadimages().I have to pass Eval("ImageName") in imgPlan ,means ImageName also to javascript.How can i do that.Can anybody help.

+1  A: 

Untested:

<asp:Button ID="btnUpload" runat="server" onclick="UploadImages("<% Eval("ImageName") %>");" Text="Upload"/>

EDIT:

onclick might need to be OnClick or OnClientClick (and you may have to put "javascript:UploadImages"

Martin
its not working.showing error
what is the error?
Martin
You probably want a normal anchor or button input rather than a server control- it sounds like you don't really want this to generate a postback at all, just run the javascript (ajax) function.
Joel Coehoorn