Because it is silly on your part to expect a server side control ID and property name to be available in client side Javascript.
I'm guessing that "ctlGridView" is the ID of your control. GridViews are rendered on the client as HTML tables... a browser does not know of anything called a GridView. In the same vein, the EditIndex property is a server side property of the GridView. Even if you would retrieve a reference to the client side HTML table rendered by your GridView, you would not find any property named "EditIndex" in that object. So, the value is not being set because the browser does not know what ctlGridView is and cannot try to lookup a property named EditIndex of that undefined object. ... and that's that ! On May 28, 6:21 pm, "ASP.Net" <[email protected]> wrote: > i am trying this: > Page.RegisterStartupScript(" ", " <script > if (confirm('You will lose > all the changes if not saved')==true){ ctlGridView.EditIndex = " + > e.NewEditIndex + ";} </script > "); > > can anyone tell me why "ctlGridView.EditIndex =" is not getting the > value at runtime.
