M
Meheraj shaik via .NET 247
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
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