开发者

Is there a better way to prepopulate fields?

I am trying to create an edit form with the database values pre-populated in the front end. Right now I have lots of literal controls that act like placeholders and I assign the values for those on page load.

Is the开发者_JS百科re a better way to do this? Or, is this the standard way of doing it?


Use databinding on the actual form fields. The syntax will vary depending on what your data source is, but in general it's something like this:

<asp:TextBox id="LastName" runat="server" 
   Text='<%# DataBinder.Eval(MyDataSource.LastName) %>'>
</asp:TextBox>
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜