How to pass parameters to java script function from OnClient Click(from the Link button in DataGrid)

I am trying  to pass parameters to java script function from OnClient Click(from the Link button in DataGrid).It is giving me the error in the grid generation itself.The error is
Server tag is not well formed.

Please see the DataGrid source and JavaScript function.

<ASP:DATAGRID id="DGrid" runat="server"  ShowFooter="False"
                        AutoGenerateColumns="False" BorderWidth="2" cellspacing="0" cellpadding="3" HeaderStyle-CssClass="TableHeaders"
                        EnableViewState="True" >
                <asp:TemplateColumn HeaderText="Number">
                            <asp:LinkButton ID="lnkNumber" runat="server" CausesValidation="false" OnClientClick="openmodaldialog2(document.getElementById(" + '<%#("lnkNumber.ClientID") %>' + ");" Text='<%# DataBinder.Eval(Container, "DataItem.ID") %>' readonly="True"></asp:LinkButton>
                        <HeaderStyle Width="200px" />
                              <ASP:BoundColumn HeaderStyle-Width="50px" HeaderText="Name" DataField="Name" readonly="True" />
                              <ASP:BoundColumn HeaderStyle-Width="100px" HeaderText="Address" DataField="Address""
                                    readonly="True" />
                              <ASP:BoundColumn HeaderStyle-Width="100px" HeaderText="State" DataField="State"
                                    readonly="True" />
                              <ASP:BoundColumn HeaderStyle-Width="100px" HeaderText="Zip" DataField="Zip"
                                     readonly="True" />

 function openmodaldialog2(Num)
         myPopUp2 = window.showModalDialog("Page1.aspx", "", "dialogHeight: 350px;dialogWidth: 650px;status:no;")
        return false;
if there is no OnClienClick() event the Grid is populating fine.
Any suggestion for passing the parameres from OnClientClick event in the DataGrid.

Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

guru_samiConnect With a Mentor Commented:
So you want to pass the ID of the linkButton to your js function or some other value from your Data?
Do you need a LinkButton or can a regular link would work?
e.g. say you want to pass some column value to your function it would look something like:

<a onclick="openmodaldialog2('<%# Eval("ID") %>');" href="#"><%# Eval("ID") %></a>

Open in new window

jinsonafConnect With a Mentor Commented:
KavyaVSAuthor Commented:
All Courses

From novice to tech pro — start learning today.