Button column select!

asp.net Uganda
  • 13 years ago

    Hi all,
    I have a datagrid with Button column select in form of hyperlink. On the same page, I have another datagrid that insert data and one column(Name) has Names of a user that is inserting data(using windows authentication). 
    Now this is how it's supposed to work: When any user want to see data about a particular user it's a matter of selecting his name and the data Writen by the selected user should be the only ones to be shown.
    I got some examples on Google but they all seem not to be working. When a user is selected the page remains the same data is not selected. How would can I solve this problem?
    My code looks like this:
    HTML part:
    <Columns>
    <asp:ButtonColumn HeaderText="Operations" DataTextField="TeamOperation" ButtonType="LinkButton"></asp:ButtonColumn>
    </Columns>
    and code behind:
    private void dgoperation_ItemCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
    {
    SqlCommand myCommand=new SqlCommand();
    myCommand.Connection=con;
    myCommand.CommandText="select * from dbo.DashBoard where Name = @Billing";     
    myCommand.Parameters.Add(new SqlParameter("@Billing",SqlDbType.VarChar,50));
    myCommand.Parameters["@Billing"].Value= dgbilling;
    SqlDataAdapter myAdapter=new SqlDataAdapter(myCommand);
    DataSet ds = new DataSet();
    myAdapter.Fill(ds);   
    dgis.DataSource=ds; 
    dgis.EditItemIndex = -1;
    dgis.DataBind();
    }






















    dgis: this is the datagrid that where user inserts data.
    dgbilling: this is the datagrid with the name list.
    Thanks.



  • 13 years ago

    hi check this url

    u can find the working example witht the code of it.

    http://quickstarts.asp.net/QuickStartv20/aspnet/Default.aspx

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“It is practically impossible to teach good programming style to students that have had prior exposure to BASIC. As potential programmers, they are mentally mutilated beyond hope of regeneration.” - E. W. Dijkstra