I have a custom asp.net server control to display images.What I need now is to draw a rectangle on the center of image and the rectangle should be re sizable by dragging on its edges.Is it possible to accomplish this using JavaScript ?. I need to embed that script in that control. Is it possible ?
-
Do any of these do what you want? pixelzdesign.com/blog_view.php?id=59 GIYFdash– dash2012-04-03 09:26:56 +00:00Commented Apr 3, 2012 at 9:26
-
Can I do it inside the control.I cannot use a separate JavaScript file. I have to do it everything inside the control itself. I am using asp.net 2.0 without ajaxSenan– Senan2012-04-03 09:37:19 +00:00Commented Apr 3, 2012 at 9:37
Add a comment
|
1 Answer
You can include a javascript file in a server control.
Add a reference to the assemblyinfo.cs
[assembly: WebResource("Custom.js", "text/javascript")]
Then a reference on the PreRender:
protected override void OnPreRender(EventArgs e)
{
base.OnPreRender(e);
string resourceName = "Custom.js";
ClientScriptManager cs = this.Page.ClientScript;
cs.RegisterClientScriptResource(typeof(CustomControls.Custom), resourceName);
}
3 Comments
Senan
I've already tried this. But it is not working in my case :-( . Actually my control has a label,text box and Image Control.What I need is to draw a re-sizable rectangle on the image
Senan
How do I access controls from the script.When I tried accessing using getElementById("controlname") it returns null