The Gridview populates an SQL query using an SQL Datasource, and I have the "Enable Selection" option checked in the smart tag of the Gridview. I also have the DataKeyNames listed.
The DetailsView has another SQL Datasource that will display results needed when the Gridview Selected Option is clicked. I have Select Parameters listed in the DetailView SQL Datasource that links to the Gridview when selected.
Problem is when I select the value in the Gridview, my page reloads however the DetailsView does not populate. My code is listed below for the aspx page, and the code behind. Any help would be greatly appreciated.
ASPX PAGE
DataSourceID="SqlDataSource2" EnableModelValidation="True"
Font-Size="Medium" ForeColor="Black" BorderColor="White" GridLines="None"
style="text-align: center" Width="645px" DataKeyNames="FirstName,LastName"
AutoGenerateSelectButton="True">
SelectCommand="SELECT FranchiseAgent.FirstName, FranchiseAgent.LastName, FranchiseAgent.IsEnrolled, aspnet_Membership.IsApproved, aspnet_Membership.IsLockedOut FROM FranchiseAgent CROSS JOIN aspnet_Membership
WHERE FranchiseAgent.FirstName = @FirstName OR FranchiseAgent.LastName = @LastName"
onselecting="SqlDataSource1_Selecting">
PropertyName="SelectedValue" />
Width="125px">
CODE BEHIND:
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class MySite: System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Gridview2.Databind();
}
}
Replies
Know the answer? Post it — somebody with the same question will find it here.