問題タブ [web-controls]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票する
1 に答える
567 参照

c# - スクリプト ブロックを使用して Web コントロールを .Aspx ページに動的に追加する

チャート コントロールを .aspx ページに追加しようとしていますが、次のエラーが発生します。

コントロールにコード ブロック (つまり <% ... %>) が含まれているため、Controls コレクションを変更できません。

このコードで:

aspx ページ自体には、コード ビハインドに 2 つの <%...%> ブロック呼び出しメソッドがあります。

<body> <div id="portletContent" runat="server"> <%=Render()%> </div> </body>以前にこの問題を解決した人はいますか? これを回避するために私が取ることができる別のアプローチはありますか?基本的に、このコントロールをこのページに挿入し、適切な場所で Render() メソッドをインラインで実行する必要があります

0 投票する
3 に答える
1229 参照

c# - ASP.NET WebControls の拡張: パブリック プロパティを効果的に非表示にする方法

DateValueTextBox WebControl を拡張して、コード ビハインドで値をプロパティ () として公開する一種の「DateTextBox」として機能させます。

このコントロールは日付でのみ使用されることになっているため、親からTextプロパティを継承する理由はありません。

それを非表示にする方法はありますか?.. a を実装する以外にNotImplementedException、次のように:

0 投票する
2 に答える
4433 参照

c# - WebControl と CompositeControl の違いは?

私はウェブを見回しており、トピックに関する記事をいくつか見つけましたが、それらの違いはまだわかりません. CompositeControl から継承した場合は完全に機能しますが、WebControl から継承した場合は機能しません。(どちらもコードをレンダリングしますが、CompositeControl だけがイベントを処理します)

そのため、ボタンをクリックしてコントロールが WebControl としてレンダリングされても、何も起こりません。しかし、WebControl を CompositeControl に変更すると、テキストが出力されます。なんで?WebControl と CompositeControl の違いは何ですか?

0 投票する
2 に答える
248 参照

c# - 独自の Web コントロールの構築

初歩的な質問ですが、これで悩んでいる人は多いと思います。

私は楽しみのために Windows/Web アプリケーションを開発し、それらを友人の場所にインストールしています。私の開発のほとんどは CRM システムに集中していますが、DB からのデータをより効果的で軽量な方法で表示することに大きな問題があります。

Microsoft の組み込み Web コントロールを使用するのは簡単で良い方法ですが、私のニーズには応えられません。さらに悪いことに、優れたソフトウェアや Web サイト (Google(笑)) の他の Web コントロールほど効果的ではありません。

独自のコントロール (GridView など) を作成したい。だから私の質問は、どうすれば自分でこれを行うことができますか?

Microsoft は、Web と Windows フォームの両方の開発用に Web コントロールをどのように構築していますか?

ありがとう!

アミット

0 投票する
2 に答える
102 参照

.net - 単一のソリューションでのカスタム ASP.NET Web コントロールの開発と使用

私は、Web サイトと、WebControl クラスから継承するコントロールを含むクラス ライブラリを使用したソリューションを持っています。コントロールをツールボックスに配置して Web サイトで使用すると、ソリューションをビルドできなくなります。Visual Studio (コンパイラ) は、クラス ライブラリ DLL が別のプロセス (VS 自体であると思われます) によって使用されていると不平を言います。

単一のソリューションでカスタム ASP.NET Web コントロールを開発して使用する方法はありますか? それとも、ここで何か不足していますか?

0 投票する
4 に答える
10956 参照

asp.net - WebControl の作成における Render と RenderControl の違いは何ですか?

最近、独自の WebControls を作成する方法を学びましたが、Render と RenderControl の違いについてはまだよくわかりません。私は Render を使い始めましたが、ある時点で RenderControl を使い始めました。現在は RenderControl のみを使用しています。悪い癖がついている場合は、自分のやり方に固執する前に、今すぐ芽を摘みたいと思います。

0 投票する
1 に答える
490 参照

.net - Web controls lifecycle problems: A page, a grid and a dialog (containing a dynamic control whose type depends on the selected row in the grid)

I have a web page with a GridView. The GridView contains a list of Question objects. Each Question has a QuestionType. When the user clicks on the Question control, an Ajax modal popup appears containing a Dialog custom web control. The Dialog web control is designed to encapsulate a child custom web control together with OK and Cancel buttons. In this scenario, the child control is a Question custom control that represents the selected Question. The exact type of the Question control is not known until a row in the GridView is clicked.

To sum up the page hierarchy:

  • Page
  • GridView containing questions (declared in the .aspx markup, fires an event when a row is clicked)
  • Panel linked to AJAX modal popup extender (declared in the .aspx markup)
  • Dialog control (declared in the .aspx markup)
  • Question control (created dynamically within the Dialog control, type not known until Question selection is made)
  • OK button (created dynamically within the Dialog control)
  • Cancel button (created dynamically within the Dialog control)

When the user clicks the OK button in the Dialog, I want to be able to get at the contents of the Dialog from the containing page. (There is code in the various Question controls that validates the answer and a property in the Dialog that exposes the answer to the containing page.)

I have been having large amounts of trouble in getting this to work.

I have been googling for hours and all articles about custom web controls state that you need to create child controls within the OnInit override. However, in my scenario, the Dialog OnInit method is called before GridView fires its row clicked event, meaning I can't create the Question control because I don't know the target type.

I can make it at least show the dynamic Question control if I move code that creates it to a later point in the lifecycle of the Dialog e.g. RenderContents. However, this is not correct according to all the articles and useless anyway because the control is still not available when the OK button in the Dialog is clicked (as the dialog is hidden and RenderContents will never be called).

So, I'm asking the ASP.NET guys on here how this is supposed to be done? I'm not looking for the code; just strategy. What is the correct way to set this up? The aim is a dialog that contains a dynamically created control whose type depends on the selected row in the GirdView and that can be accessed by the containing page after a postback.

Any tips would be greatly appreciated.

UPDATE

I added logging and the order of events firing after the grid is clicked is as follows:

  • Page ctor
  • Dialog ctor
  • Dialog OnInit
  • Page OnInit
  • Page CreateChildControls
  • Dialog CreateChildControls
  • Page OnLoad
  • Dialog OnLoad
  • Page OnContactorComplianceQuestionSelected
  • Dialog RenderContents

I only know what type of control the Dialog is supposed to contain after Page OnContactorComplianceQuestionSelected.

0 投票する
1 に答える
1646 参照

asp.net - ASP.NET WebControl とレンダリングに含まれる子

内部にマークアップを格納できる WebControl を作成し、独自の子コントロールを動的に作成しようとしています。私が抱えている問題は、作成した子コントロールとは別に、マークアップに格納されたコントロール (以下の例を参照) を (まだ) レンダリングできないことです。

これらの 2 つのフラグを使用してクラスを設定する必要があることは承知しています。

サンプルのマークアップは次のようになります。

RenderContents()内には、コントロール ツリーに追加してレンダリングし、特定の部分でマークアップにラップされたものをレンダリングする必要があるいくつかのコントロールがあります。例えば:

前述のように、コードで作成したコントロールをRenderChildren()の呼び出しから 2 回レンダリングするか、その行を削除してラップされたコントロールをまったくレンダリングしないようにすることができます。ダーン。

考え?