Nov 08, 2012, 9:32 PM
[CLOSED] How to load formpanel textfields with data from sql database
Hello Daniil, I would like ask you for help. I have formpanel with some textfield,datefield etc. and I need fill this formpanel with data from sql database by use of SqlDataReader object (or similar). I think that there is some method to databind & fill textfileds in FormPanel with record read from database. Thank you for help. ASAPCH
<ext:FormPanel
ID="formpanelBasic"
runat="server"
Title="Basic"
DefaultAnchor="100%"
BodyPadding="5">
<Items>
<ext:TextField ID="FirstName" runat="server" FieldLabel="First Name" Name="FirstName" />
<ext:TextField ID="LastName" runat="server" FieldLabel="Last Name" Name="LastName" />
<ext:DateField ID="EntryDate" runat="server" FieldLabel="Entry date" Format="yyyy-MM-dd" Name="EntryDate" />
</Items>
</ext:FormPanel>
.....
.....
SqlDataReader myDataReader = GetSQLRecordById(id);
if (myDataReader.Read())
{
formpanelBasic.SetValues(myDataReader);// this doesnt work
// following code I want to replace with one function call
this.FirstName.Text = myDataReader["FirstName"].ToString();
this.LastName.Text = myDataReader["LastName"].ToString();
this.EntryDate.Text = String.Format("{0:yyyy-MM-dd}", myDataReader["EntryDate"]); }
....
Last edited by Daniil; Nov 15, 2012 at 2:38 PM.
Reason: [CLOSED]