Quantcast
Channel: SharePoint 2010 - General Discussions and Questions forum
Viewing all articles
Browse latest Browse all 17574

Call javascript from datalist

$
0
0

Hi I want to call javacript code that populates the parent window. In my aspx page I have an sqlDataSource followed by a DataList.

<asp:DataList runat="server" id="DataList1" DataSourceID="SqlDataSource2"><ItemTemplate>
        Id:<asp:Label Text='<%# Eval("Id") %>' runat="server" id="IdLabel" /><br />
        CustomerName:<asp:Label Text='<%# Eval("CustomerName") %>' runat="server" id="CustomerNameLabel" /><br />
        CustomerAddress:<asp:Label Text='<%# Eval("CustomerAddress") %>' runat="server" id="CustomerAddressLabel" /><br />
        CustomerDOB:<asp:Label Text='<%# Eval("CustomerDOB") %>' runat="server" id="CustomerDOBLabel" /><br /><br /><input name="BtnSelect" type="button" value="Select" onclick="javascript:PopulateParent("<%# Eval("CustomerAddress") %> ");"/></ItemTemplate></asp:DataList>

when the button is pressed i want the values of CustomerName and CustomerAddress to be passed to my Javascript code. I've added the onclick to standard button within ItemTemplate but i recieve errors.

What’s the best way to do this, I dont necessarily need to use a DatList, also tried a GridView but still have a problem incorporating onclick.

onclick works without the server code bit i.e.

onclick="javascript:PopulateParent();

Viewing all articles
Browse latest Browse all 17574

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>