Hyper link in Datagrid

Discussion in 'ASP .Net' started by Meheraj shaik via .NET 247, May 28, 2005.

  1. hi friends,
    I've dynamically created hyperlink and other columns in a grid.iwant to change hyperlink's text property dynamically.i've twotables products & specials.data from product table is diaplayedin grid,if that tables id is existing in specials thenhyperlink's text is editspecial and if it's new then text isnewspecial.when link is clicked it diaplays specials page.
    my problem instead of one hyperlink a new hyperlink column iscreated for each row in grid.if 4 rows then 4 hyperlinkcolumns.
    I'm giving u code also:
    HyperLink edit=new HyperLink();
    for(int i=0;i<ds.tables[0].count;i++) //products
    {
    int prodid=convert.toint32(ds.tables[0].rows["id"].text);
    string qry="select specialsid from specials where id=prodid;
    sqldataAdapter sda=new sqldataadapter(qry,con);
    sqldataAdapter.fill(ds);
    if(ds.tables[0].rows.count > 0)
    {
    edit.text="editspecial";
    }
    else
    {
    edit.text="New Special";
    }
    edit.datanavigateurl="id";
    edit.datanavlgateurlformatstring="specials.aspx"?id{0};
    dg.addcolumns((Datacolumn)edit);
    }
    //other columns are created below
    dg.databind();
    please give me the solution ,thank you


    From: Meheraj shaik

    -----------------------
    Posted by a user from .NET 247 (http://www.dotnet247.com/)

    <Id>w4KoqagwQ0C41f9bOgkZQw==</Id>
     
    Meheraj shaik via .NET 247, May 28, 2005
    #1
    1. Advertising

  2. Meheraj shaik via .NET 247

    TC Guest

    You want to intercept the data is it comes into the datagrid_itemdatabound
    event. here you can interrogate the values in the cells (1 row at a time)
    and take the appropriate action.

    TC


    "Meheraj shaik via .NET 247" <> wrote in message
    news:%...
    hi friends,
    I've dynamically created hyperlink and other columns in a grid.i want to
    change hyperlink's text property dynamically.i've two tables products &
    specials.data from product table is diaplayed in grid,if that tables id is
    existing in specials then hyperlink's text is editspecial and if it's new
    then text is newspecial.when link is clicked it diaplays specials page.
    my problem instead of one hyperlink a new hyperlink column is created for
    each row in grid.if 4 rows then 4 hyperlink columns.
    I'm giving u code also:
    HyperLink edit=new HyperLink();
    for(int i=0;i<ds.tables[0].count;i++) //products
    {
    int prodid=convert.toint32(ds.tables[0].rows["id"].text);
    string qry="select specialsid from specials where id=prodid;
    sqldataAdapter sda=new sqldataadapter(qry,con);
    sqldataAdapter.fill(ds);
    if(ds.tables[0].rows.count > 0)
    {
    edit.text="editspecial";
    }
    else
    {
    edit.text="New Special";
    }
    edit.datanavigateurl="id";
    edit.datanavlgateurlformatstring="specials.aspx"?id{0};
    dg.addcolumns((Datacolumn)edit);
    }
    //other columns are created below
    dg.databind();
    please give me the solution ,thank you


    From: Meheraj shaik

    -----------------------
    Posted by a user from .NET 247 (http://www.dotnet247.com/)

    <Id>w4KoqagwQ0C41f9bOgkZQw==</Id>
     
    TC, Jul 19, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. k-re
    Replies:
    1
    Views:
    1,739
    Tim S.
    Jun 25, 2003
  2. Hyper Link in DataGrid

    , Mar 3, 2006, in forum: ASP .Net
    Replies:
    3
    Views:
    509
    Patrick.O.Ige
    Mar 3, 2006
  3. Yann.K
    Replies:
    9
    Views:
    353
    Nemesis
    Sep 8, 2004
  4. Jonathan  Ellis

    Re: open default MUA with a hyper link

    Jonathan Ellis, Sep 3, 2004, in forum: Python
    Replies:
    2
    Views:
    322
    Thierry S.
    Sep 6, 2004
  5. Alexander Kaplunov

    hyper link in DataGrid

    Alexander Kaplunov, Dec 17, 2003, in forum: ASP .Net Web Controls
    Replies:
    3
    Views:
    202
    Alexander Kaplunov
    Dec 18, 2003
Loading...

Share This Page