Please help me,

i dont know what is wrong with this code
it return with error:

No overload for 'GridView1_SelectedIndexChange' matches delegate 'System.EventHandler'


<%@ Page Language="C#" MasterPageFile="~/msportal.master"  AutoEventWireup="true" CodeFile="Download.aspx.cs" Inherits="Download" Title="Download Page" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <asp:Label ID="Label1" runat="server"></asp:Label>       
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="Data Source=localhost\SQLEXPRESS;Initial Catalog=lemaridata;Integrated Security=True" 
        ProviderName="System.Data.SqlClient" SelectCommand="SELECT * FROM [uplod]">
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
            AllowPaging="True" BackColor="White" BorderColor="#CCCCCC" BorderStyle="None" 
            BorderWidth="1px" Caption="Uploaded Media" CaptionAlign="Top" CellPadding="4" 
            DataKeyNames="ID" ForeColor="Black" GridLines="Horizontal" 
        PageSize="5" onselectedindexchanged="GridView1_SelectedIndexChanged">
                <asp:BoundField DataField="ID" HeaderText="ID" ReadOnly="True" 
                    SortExpression="ID" />
                <asp:BoundField DataField="FileName" HeaderText="FileName" 
                    SortExpression="FileName" />
                <asp:BoundField DataField="Extension" HeaderText="Extension" 
                    SortExpression="Extension" />
                <asp:ButtonField ButtonType="Button" CommandName="Select"  Text="Download" 
                    HeaderText="Option" ShowHeader="True" />
            <FooterStyle BackColor="#CCCC99" ForeColor="Black" />
            <HeaderStyle BackColor="#333333" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="White" ForeColor="Black" HorizontalAlign="Right" />
            <SelectedRowStyle BackColor="#CC3333" Font-Bold="True" ForeColor="White" />

and the

using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Data.Sql;
using System.IO;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class Download : System.Web.UI.Page
    protected void Page_Load(object sender, EventArgs e)

    protected void GridView1_SelectedIndexChanged(object sender, GridViewSelectEventArgs e)
            SqlConnection con = new SqlConnection("Data Source=localhost\\SQLEXPRESS;Initial Catalog=lemaridata;Integrated Security=True");
            String ID = (GridView1.DataKeys[e.NewSelectedIndex].Value).ToString();
            String qry = "Select * From uplod Where(ID=" + ID + ")";
            SqlCommand cmd = new SqlCommand(qry, con);

            SqlDataReader reader = cmd.ExecuteReader();

            string filename = (String)reader.GetValue(1);
            byte[] fileToDownload = (byte[])reader.GetValue(2);
            String fileExtension = (String)reader.GetValue(3);

            Response.AddHeader("Content-Disposition", "attachment; filename=" + filename);
            Response.ContentType = fileExtension;
            Response.AddHeader("Content-Length", fileToDownload.Length.ToString());


        catch (System.Exception exp)
            Label1.Text = (exp.Message);


please help...

I going to recode what you have to update

1) protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
2) String ID = (GridView1.DataKeys[GridView1.SelectedRow.DataItemIndex].Value).ToString();

//Or I think you can do this.
String ID = GridView1.SelectedDataKey.Value.ToString();

Great!!! its work... thanks jbisono :) :) :)

can i ask u something else...

i want to get user name and userid from loginview and loginname control,
for user name i can retrive from:

DateLabel.Text = DateTime.Today.ToShortDateString();
        if (HttpContext.Current.User.Identity.IsAuthenticated)
            string myUserName = HttpContext.Current.User.Identity.Name;
            Label2.Text = myUserName;

but not the userId, how can i get that UserId...
thank you for the help

Don't mention it, we are here to help.

About your second question, you should start another Thread, so we can keep Daniweb's people happy.

If you want post the link of your new thread here, so i can get a email and i will answer your question.

you have added "GridView1_SelectedIndexChange" in aspx page but its event code not added in aspx.cs page
protected void GridView1_SelectedIndexChange(object sender, EventArgs e)