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: The method has the following code: The ID that is passing as a parameter is unique in the database. I get a JavaScript error: JavaScript runtime error: 'EID' is undefined JavaScript runtime error: 'EID' is undefined < P> Now, in the C # code,
function update (eid) {window.location ( "Events.aspx Id =" + Id); }
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);"); }}
eid is a variable You must have it
cbx.Attributes.Add ( "onclick", "Update (" + eid + ");");
Comments
Post a Comment