Click here to Skip to main content
15,892,746 members
Please Sign up or sign in to vote.
2.00/5 (2 votes)
See more:
I want to retrive video from SQL server using Gridview .And want on the user end if a user cliks on video name it retreive that specific video. I had retrieve the video using a button but now I want to add link in video name coloumn to rertieve it ..Here Is mY code .

C#
 SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["videoConnectionString"].ConnectionString);
    private DataTable GetSpecificVideo(object i)
    {
        SqlDataAdapter adapter = new SqlDataAdapter("SELECT Video, ID FROM video4 WHERE id = @ID", connection);
        adapter.SelectCommand.Parameters.Add("@id", SqlDbType.Int).Value = (int)i;
        DataTable table = new DataTable();
        adapter.Fill(table);
        return table;
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        int id = Convert.ToInt32(TextBox1.Text);
        Repeater1.DataSource = GetSpecificVideo(id);
        Repeater1.DataBind();
    }
}


Please Help me how to add link in Gridview Instead of using video ID. Thanks In Advance
Posted
Updated 26-Apr-14 3:04am
v2
Comments
Add HyperLink inside one TemplateField Column.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900