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>
精彩评论