views:

170

answers:

2

I have the following:

<EditItemTemplate>
                    <asp:Button ID="wrqst_need_ind_btn" runat="server" Text = "Create WR" 
                        onClientClick="javascript:popUp('popup_createWR.aspx')"
                        CommandArgument='<%# Eval("dvc_nm") + "|" + Eval("data_orgtn_yr") %>'/>
 </EditItemTemplate>

I want to pass in as two additional params the Eval("dvc_nm") and Eval("data_orgtn_yr") to the popup function.

how do I do this?

Thanks so much for the help!

UPDATE:

I tried the suggestion bellow, and I tried by removing the single quotes from insode the <% %> tags. Which gave me this:

onClientClick='<%# "javascript:popUp(popup_createWR.aspx," + Eval("dvc_nm") + "," + Eval("data_orgtn_yr") + ")" %>'

which complied, but when I clicked the button I did not get a pop up, the page just posted back and reloaded and said errors on page, but no popup...

A: 

This should work

  <asp:Button ID="wrqst_need_ind_btn" runat="server" Text = "Create WR" 
                    onClientClick='<%# "javascript:popUp('popup_createWR.aspx','" + Eval("dvc_nm") + "','" + Eval("data_orgtn_yr") + "')" %>'
                    CommandArgument='<%# Eval("dvc_nm") + "|" + Eval("data_orgtn_yr") %>'/>
alejandrobog
I typed it in exactly like that, and got a server tag is not well formed error... any ideas?
kralco626
+1  A: 

Try this instead:

ASPX:

<asp:Button ID="wrqst_need_ind_btn" runat="server" Text="Create WR"
    onClientClick="<%# GetPopupScript() %>" />

Code-behind:

protected string GetPopupScript()
{
    return string.Format( "javascript:popUp('popup_createWR.aspx', '{0}', '{1}')", Eval( "dvc_nm" ), Eval( "data_orgtn_yr" ) );
}
dave thieben
how can i look at the html code that is generated?
kralco626
just view the source from your browser.
dave thieben
but that doesn't work if the page wont even compile...
kralco626
okay, I updated my answer. try it out.
dave thieben
works. I had to modify it a bit to meet my specific need, but thanks sooo much!
kralco626