c# - How to pass parameter to javascript dynamically -


I have a repeater control on the aspx page and in that page I have kept the checkbox when a user checks this box , Then I want to redirect to a page. To do this, I have also written a java script:

JS:

  function update (eid) {window.location ( "Events.aspx Id =" + Id); }   

The method has the following code:

  Secure void rptEventReminder_ItemDataBound (Object Sender, RepeaterItemEventArgs e) {checkbox cbx = checkbox As e ITEM FontControl ("chkComplete"); Label labeled lbl = e.Item.FindControl ("lblEid"); If (CBX! = Null & LBL! = Null) {Int64 eid = Convert. ToInt64 (lbl.Text); Cbx.Attributes.Add ("onclick", "update (eid);"); }}   

The ID that is passing as a parameter is unique in the database.

I get a JavaScript error:

JavaScript runtime error: 'EID' is undefined

, Which is considered as a JavaScript variable, therefore you get an error

JavaScript runtime error: 'EID' is undefined < P> Now, in the C # code, eid is a variable You must have it

  cbx.Attributes.Add ( "onclick", "Update (" + eid + ");");    

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -