Here is my sql datasource details
<asp:SqlDataSource ID="dsMoodleQuiz" runat="server"
ConnectionString="<%$ ConnectionStrings:OnlineMeetingConnectionString %>"
ProviderName="<%$ ConnectionStrings:OnlineMeetingConnectionString.ProviderName %>"
SelectCommand="SELECT Name, UserID, Grade, FirstName, LastName, Email, TimeModified, IDNumber FROM tbMoodleQuiz WHERE (FirstName = @FirstName) AND (LastName = @LastName)"
onselecting="dsMoodleQuiz_Selecting">
<SelectParameters>
<asp:Parameter Name="FirstName" />
<asp:Parameter Name="LastName" />
</SelectParameters>
</asp:SqlDataSource>
A gridview by name gvDetails is attached to dsMoodleQuiz . On button click
I would like
gridview to get populated.
Here is the code on button click
protected void btnSearch_Click(object sender, EventArgs e)
{
dsMoodleQuiz.SelectParameters.Add("@FirstName", System.Data.DbType.String, "Jhon");
dsMoodleQuiz.SelectParameters.Add("@LastName", System.Data.DbType.String, "Wald");
GridView1.DataBind();
}
Why is this not working ...?? Am I missing any code ...?? Appreciate the help
Using the following code in databaindg
Note: I dont have visual studio with me, so the code is not copy, pastable.
This is sample example on how to search grid view and populating results on that search criteria using sqldatasource.....
grid view binding .....
and sql datasource is like this ...
adding text box for searching ..
and this is code for binding and entering text into text box
and this is the css style for hilighting..
and this is teh image for the above grid view
i hope it will helps you...