|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Make links different color in the datagridI'm using the standard datagrid control in my ASP.NET page. I have the latest version and all service packs of the framework installed. I am using the property builder to create my grid. My question is simple: How do I make the links in different cells adopt a specific CSS class? For instance, my header row in set to maroon and my links set to white. This makes the sortable columns headings display nicely (white on maroon background). But if I try to use a link somewhere else in my grid (ie. a Hyperlink column) then it also appears as white on a WHITE background. How do I make the links in the header row use CSS class .linkHeader, but make the links in the hyperlink column use .linkStandard? I tried the following but obviously it doesn't work: <asp:HyperLinkColumn Text="..." DataNavigateUrlField="master_id_account" DataNavigateUrlFormatString="Edit.aspx?masterIdAccount={0}" CssClass="linkStandard"></asp:HyperLinkColumn> ['System.Web.UI.WebControls.HyperLinkColumn' does not have a property named 'CssClass'.] Mike Mike Chamberlain wrote:
Show quoteHide quote > Hi. I found a partial workaround myself. First set the UseAccessibleHeader > > I'm using the standard datagrid control in my ASP.NET page. I have the > latest version and all service packs of the framework installed. I am > using the property builder to create my grid. My question is simple: > How do I make the links in different cells adopt a specific CSS class? > > For instance, my header row in set to maroon and my links set to white. > This makes the sortable columns headings display nicely (white on > maroon background). But if I try to use a link somewhere else in my > grid (ie. a Hyperlink column) then it also appears as white on a WHITE > background. > > How do I make the links in the header row use CSS class .linkHeader, but > make the links in the hyperlink column use .linkStandard? I tried the > following but obviously it doesn't work: > > <asp:HyperLinkColumn Text="..." DataNavigateUrlField="master_id_account" > DataNavigateUrlFormatString="Edit.aspx?masterIdAccount={0}" > CssClass="linkStandard"></asp:HyperLinkColumn> > > ['System.Web.UI.WebControls.HyperLinkColumn' does not have a property > named 'CssClass'.] > > Mike property of the grid to True, which tells it to render the table properly (using <TH> tags for the header cells rather than <TD> - why this isn't the default is beyond me). Then, two styles can be defined TH A { color:white; } TD A { color:maroon; } which works fine for now. But what happens if I want to have a link of one color in one Hyperlink column, and one of a different color in another? Any suggestions appreciated. Mike Mike Chamberlain wrote:
Show quoteHide quote > Hi. If the other columns don't contain links, you can set the CssClass property > > I'm using the standard datagrid control in my ASP.NET page. I have > the latest version and all service packs of the framework installed. I am > using the property builder to create my grid. My question is > simple: How do I make the links in different cells adopt a specific > CSS class? > For instance, my header row in set to maroon and my links set to > white. This makes the sortable columns headings display nicely > (white on maroon background). But if I try to use a link somewhere > else in my grid (ie. a Hyperlink column) then it also appears as > white on a WHITE background. > > How do I make the links in the header row use CSS class .linkHeader, > but make the links in the hyperlink column use .linkStandard? I > tried the following but obviously it doesn't work: > > <asp:HyperLinkColumn Text="..." > DataNavigateUrlField="master_id_account" > DataNavigateUrlFormatString="Edit.aspx?masterIdAccount={0}" > CssClass="linkStandard"></asp:HyperLinkColumn> > ['System.Web.UI.WebControls.HyperLinkColumn' does not have a property > named 'CssClass'.] > > Mike of the ItemStyle and AlternatingItemStyle. -- Riki
5th Re-Post with NO RESPONSE FROM MS!
Questions concerning detailsview or datagrid ASP.NET 2.0 Can't get a reference to user control in datagrid Problem with Top And Bottom Paging How to capture CheckChanged event from Radiobutton in Datagrid? radiobutton and datagrid DataGrid sort when Editing Handling events for Checkbox in Data Grid search function on different page selected How to put the result of 2 DataReader in a DataList?? |
|||||||||||||||||||||||