开发者

Creating binding in codebehind

I have this type of code in aspx but wish to gene开发者_运维问答rate it in code behind. What would be the equivalent?

<uc1:editformcontrol ID="EditFormControl1" runat="server" CategoryID=' <%#Bind("CategoryID") %>' />

The question pertains mainly to the binding


It's difficult to say without knowing your data model. What kind of data source are you using? You could try adding this line to the Page_Load method:

int categoryId;
categoryId = WHEREEVER YOU'RE STORING THIS VALUE...
EditFormControl1.CategoryID = categoryId;


Usually, you override the OnDataBound event on your control and bind the data there.

See here one example.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜