<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CellPadding="4" ForeColor="#333333" GridLines="None" Width="178px"> <alternatingrowstyle backcolor="White" /> <columns> <asp:HyperLinkField Text="Profile" /> <asp:BoundField DataField="Fname" HeaderText="Name" /> <asp:BoundField DataField="Lname" HeaderText="Last Name" /> <asp:ImageField DataImageUrlField="Pic" HeaderText="Profile"> <controlstyle height="70px" width="70px" /> </columns> <editrowstyle backcolor="#2461BF" /> <footerstyle backcolor="#507CD1" font-bold="True" forecolor="White" /> <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" /> <pagerstyle backcolor="#2461BF" forecolor="White" horizontalalign="Center" /> <rowstyle backcolor="#EFF3FB" /> <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" /> <sortedascendingcellstyle backcolor="#F5F7FB" /> <sortedascendingheaderstyle backcolor="#6D95E1" /> <sorteddescendingcellstyle backcolor="#E9EBEF" /> <sorteddescendingheaderstyle backcolor="#4870BE" />
protected void TextBox1_TextChanged(object sender, EventArgs e) { SqlConnection cn = new SqlConnection("Data Source=.\\SQLEXPRESS;AttachDbFilename=|DataDirectory|\\Database.mdf;Integrated Security=True;User Instance=True"); cn.Open(); SqlCommand cmd = new SqlCommand("SELECT Registration1.Fname, Registration1.Lname, alumniregister.Pic, studentregister.Pic AS Expr1 FROM Registration1 FULL OUTER JOIN alumniregister ON Registration1.r_ID = alumniregister.r_ID FULL OUTER JOIN studentregister ON Registration1.r_ID = studentregister.r_ID where Fname like '" + TextBox1.Text + "%' or Lname like '" + TextBox1.Text + "%' ", cn); SqlDataReader dr = cmd.ExecuteReader(); GridView1.DataSource = dr; GridView1.DataBind(); cn.Close(); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)