Hello all,
I am hoping someone here will be able to help me convert two examples to using SqlDataSource. These are the two examples:
http://examples.ext.net/#/GridPanel/Data_with_Details/Form_Details/
http://examples.ext.net/#/GridPanel/Miscellaneous/Details_Window_Remote/
In the first example, I am able to display the grid values from a SqlDataSource but when I select a grid row, I am unable to display its details. If someone can show me how to modify the code at the top to work with a SqlDataSource, I would be very grateful. Further, if it would be possible to add a New, Save, and delete button to that first example, that is really what I am trying to get. The full code is at the example site, but I believe the area that needs to be updated is:
<script runat="server">
protected void RowSelect(object sender, AjaxEventArgs e)
{
string employeeID = e.ExtraParams["EmployeeID"];
Employee empl = Employee.GetEmployee(int.Parse(employeeID));
this.EmployeeID.Text = empl.EmployeeID.ToString();
this.FirstName.Text = empl.FirstName;
this.LastName.Text = empl.LastName;
this.Title.Text = empl.Title;
if(empl.ReportsTo.HasValue)
{
Employee reportsTo = Employee.GetEmployee(empl.ReportsTo.Value);
this.ReportsTo.Text = reportsTo != null ? reportsTo.LastName : "";
}
this.HireDate.SelectedDate = empl.HireDate.HasValue ? empl.HireDate.Value : DateTime.MinValue;
this.Extension.Text = empl.Extension;
this.Address.Text = empl.Address;
this.City.Text = empl.City;
this.PostCode.Text = empl.PostalCode;
this.HomePhone.Text = empl.HomePhone;
this.TitleCourt.Text = empl.TitleOfCourtesy;
this.BirthDate.SelectedDate = empl.BirthDate.HasValue ? empl.BirthDate.Value : DateTime.MinValue;
this.Region.Text = empl.Region;
this.Country.Text = empl.Country;
this.Note.Text = empl.Notes;
}
protected void Store1_Refresh(object sender, StoreRefreshDataEventArgs e)
{
this.Store1.DataBind();
}
</script>
and
<SelectionModel>
<ext:RowSelectionModel runat="server" SingleSelect="true">
<AjaxEvents>
<RowSelect OnEvent="RowSelect" Buffer="250">
<EventMask ShowMask="true" Target="CustomTarget" CustomTarget="#{Details}" />
<ExtraParams>
<%-- or can use params[2].id as value --%>
<ext:Parameter Name="EmployeeID" Value="this.getSelected().id" Mode="Raw" />
</ExtraParams>
</RowSelect>
</AjaxEvents>
</ext:RowSelectionModel>
</SelectionModel>
Thank you in advance for any help.
Jay