문제

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 ?

도움이 되었습니까?

해결책

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);
}

Here is a nice article on the subject

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top