我将前往this example并尝试使用SqlDataSource
代替LinqDataSource
。我可以在表格中显示数据,但是当我选择一行时,表单不会填充数据。我认为这些是相关的代码:
protected void RowSelect(object sender, DirectEventArgs e)
{
string employeeID = e.ExtraParams["EmployeeID"];
Employee empl = Employee.GetEmployee(int.Parse(employeeID));
this.FormPanel1.SetValues(new {
empl.EmployeeID,
empl.FirstName,
empl.LastName,
...........
});
}
和
<SelectionModel>
<ext:RowSelectionModel runat="server" Mode="Single">
<DirectEvents>
<Select OnEvent="RowSelect" Buffer="250">
<EventMask ShowMask="true" Target="CustomTarget" CustomTarget="#{FormPanel1}" />
<ExtraParams>
<ext:Parameter Name="EmployeeID" Value="record.getId()" Mode="Raw" />
</ExtraParams>
</Select>
</DirectEvents>
</ext:RowSelectionModel>
</SelectionModel>
protected void Store1_Refresh(object sender, StoreReadDataEventArgs e)
{
this.Store1.DataBind();
}
答案 0 :(得分:1)
这似乎可以解决问题:
<SelectionModel>
<ext:RowSelectionModel ID="RowSelectionModel1" runat="server" Mode="Single">
<Listeners>
<Select Handler="#{FormPanel1}.getForm().loadRecord(record);" />
</Listeners>
</ext:RowSelectionModel>
</SelectionModel>