Hi Felix,
Welcome to the MSDN newsgroup.
As for the put two columns as one and set the control's visibility
according to another database column's value, I think you can consider
using the following approach:
1. Define a template column(field) in the GridView control and add the two
Hyperlink controls in that template field.
2. Register the GridView's RowDataBound event, retrieve the two hyperlink
controls' reference and set their properties according to the current
DataItem's certain value.
For example, suppose we define the following templateFields in Gridview:
<asp:GridView ID="GridView1" runat="server"
OnRowDataBound="GridView1_RowDataBound">
<Columns>
<asp:TemplateField >
<ItemTemplate>
<asp:HyperLink id="hlOne" runat="server">Link
One</asp:HyperLink>
<asp:HyperLink id="hlTwo" runat="server">Link
Two</asp:HyperLink>
</ItemTemplate>
</asp:TemplateField>
........................
In RowDataBound Event, we can use the following code to get inner control
reference:
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs
e)
{
HyperLink link1 = e.Row.FindControl("hlOne") as HyperLink;
HyperLink link2 = e.Row.FindControl("hlTwo") as HyperLink;
//e.Row.DataItem
}
Also, e.Row.DataItem is the current DataItem , we can query certain
column's value from it. Use DataBinder.Eval or explicitly cast it to a
concrete data class object(like DataRowView)...
#GridView.RowDataBound Event
http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.
rowdatabound.aspx
Hope this helps.
Regards,
Steven Cheng
Microsoft Online Support

Signature
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Felix_WafyTech - 21 Feb 2006 12:47 GMT
Thanks Steven, your suggestion worked.
> Hi Felix,
>
[quoted text clipped - 43 lines]
>
> #GridView.RowDataBound Event
http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.
> rowdatabound.aspx
>
[quoted text clipped - 8 lines]
> (This posting is provided "AS IS", with no warranties, and confers no
> rights.)
Steven Cheng[MSFT] - 22 Feb 2006 01:23 GMT
You're welcome Felix,
Best Regards,
Steven Cheng
Microsoft Online Support

Signature
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)