I have a GridView that shows a list of users. Each user has a first name, last name, and other data you would expect a user to have. Each value is exposed through BoundField. For instance, first name is available through “FirstName”, last name is available by “LastName”.
When a user clicks a LinkButton I have in a TemplateField, I need to execute some JavaScript. This JavaScript function requires both the FirstName and LastName. Currently, I am trying something like this:
<asp:LinkButton ID="lbPrompt" runat="server" Text="prompt" CommandName="Prompt"
CommandArgument='<%# Eval("UserName") %>'
OnClientClick='<%# Eval("FirstName", "LastName", "return askUser(\"{0}\",\"{1}\");") %>' />
This statement does not work because the Eval method does not accept this kind of overload. How do I accomplish this task?
Thanks
1 Answer