如何更改此Ext.Net示例以使用Sql而不是Linq?

时间:2012-10-23 21:20:25

标签: c# sql sqldatasource ext.net linqdatasource

我将前往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();
}

1 个答案:

答案 0 :(得分:1)

这似乎可以解决问题:

<SelectionModel>
    <ext:RowSelectionModel ID="RowSelectionModel1" runat="server" Mode="Single">
        <Listeners>
            <Select Handler="#{FormPanel1}.getForm().loadRecord(record);" />
        </Listeners>
    </ext:RowSelectionModel>
</SelectionModel>