문제

Does the row below is required in AssemblyInfo.cs if i want to add an embedded script to the assembly with my custom usercontrol? Does exists any alternative to this?

[assembly: System.Web.UI.WebResource("Modal.js", "text/javascript")]

I'm developing custom IScriptControl that has JS. Both, CS and JS of the control are in same assembly. In the control, i have a lines:

ScriptReference reference = new ScriptReference();
reference.Assembly = "Modal";
reference.Name = "Modal.js";
도움이 되었습니까?

해결책

I found a solution.

[assembly: System.Web.UI.WebResource("Modal.js", "text/javascript")]

can be written or in AssemblyInfo.cs or above of namespace

[assembly: System.Web.UI.WebResource("Modal.js", "text/javascript")]
namespace Core.Web.UI.ScriptControls
{

Now it easier for developers to add new controls.

다른 팁

You could embed the script into the assembly containing the control which the developers will use without the need to declare it in their own assembly. Microsoft did the same thing with the System.Web assembly containing their base controls, so all that a developer needs is reference this assembly. and place the control onto the WebForm.

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