part of the .aspx code
<asp:SqlDataSource ID="SqlDataSource2" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT Stud_ID, Stud_Name, FileNumber FROM ActiveFiles WHERE (Stud_ID LIKE Stud_ID) OR (Stud_Name LIKE Stud_Name) ORDER BY FileNumber">
</asp:SqlDataSource>
<asp:Repeater ID="Repeater1" runat="server" onitemcommand="Repeater1_ItemCommand">
<ItemTemplate>
<hr />
<%# DataBinder.Eval(Container.DataItem, "Stud_ID") %>
<tb>
<%# DataBinder.Eval(Container.DataItem, "Stud_Name") %>
<tb>
<asp:LinkButton ID="LinkButton1" CommandName="FileNo" OnClick="LinkButton1_Click"
Text=<%# DataBinder.Eval(Container.DataItem, "FileNumber") %> runat="server"/>
</tb>
<hr />
</ItemTemplate>
...
</asp:Repeater>
part of the .cs code
protected void SearchButton_Click(object sender, EventArgs e)
{
string ID_OR_name = TextBox1.Text;
if (TextBox1.Text != string.Empty)
{
SqlConnection conn = new SqlConnection(connectionString);
conn.Open();
SqlCommand selectStatement = new SqlCommand("SELECT * FROM ActiveFiles WHERE (Stud_ID LIKE '% " + ID_OR_name + "%') OR (Stud_Name LIKE '%" + ID_OR_name + "%') ORDER BY FileNumber", conn);
SqlDataReader datTable = selectStatement.ExecuteReader();
Repeater1.DataSource = datTable;
Repeater1.DataBind();
conn.Close();
GridView2.DataBind();
GridView2.Visible = true;
Response.Write("Search query produced this results");
}
else
Response.Write("Plis enter ID or name to search");
}
protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e)
{
if (e.CommandName == "FileNo")
{
Response.Write("good");
//redirect to the page that displays the searched student's detail
//this is where im stuck
}
}