Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Changing Gridview Text Font Size on RowDataBoundChanging Gridview Text Font Size on RowDataBound
Previous
 
Next
New Post
1/10/2009 4:34 PM
 

Hello,

 

I'm still fairly new to DNN and I'm creating a search that would display the results in a gridview, but I also wanted to change the font size and add a link depending on certain criteria.  I thought that if I did it in the gridview's RowDataBound, I would be able to change the font size like so:

Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBound
            If e.Row.Cells(2).Text.Trim >= 0 Then
                    e.Row.Cells(3).Text = "<a href = '" & EditUrl() & "?ItemID=" & e.Row.Cells(1).Text.ToString & "'>" & e.Row.Cells(3).Text & "</a>"
                    e.Row.Cells(3).Font.Size = 15
            End If
        End Sub

It creates the link perfectly fine, but the font size isn't affected at all.  I think it may have to do with the priority of the styles have in DNN (Skin, then page (I think..)), but does anyone know of any way that I can override the skin's font style at runtime?

Thanks,


Kev

 
New Post
1/11/2009 1:32 AM
 

 Hey Kevin,

You might want to emit a css class on your anchor tag and stylt the tag using CSS rather than set the font size programatically. This option gives you a lot more flexibility as far as changing the look and feel of the elements over time without having to make "heavier" code changes.

for example:

 e.Row.Cells(3).Text = "<a class="special" href = '" & EditUrl() & "?ItemID=" & e.Row.Cells(1).Text.ToString & "'>" & e.Row.Cells(3).Text & "</a>"

then in your module.css file:

.special

{

font-size: 15px;

}

Hope that helps,

Ian


Software Engineer
Co-Founder, dnnGallery
Stack Overflow: Ian Robinson
Twitter: @irobinson
Linked In: Ian Robinson
 
New Post
1/11/2009 9:08 PM
 

Ian,


Thank you for replying.  I tried that out and it didn't have any effect.  I look at the source and I see that the style for the table row has been set to 15 by something else (the skin, I'm guessing):

<td align="left" style="font-size:15pt;"><a class='special' href = 'http://localhost/rvic/Search/....blahblahblah.....

I changed the module.css text size to 30 to verify that the style sheet could change the font size, but it still had no effect.  Is it a matter of another style overriding mine?  How can I can 'trump' that?

Thanks,


Kev

 
New Post
1/12/2009 10:23 AM
 

Hey Kevin,

Try adding !important to your CSS class.

Take care,

Ian


Software Engineer
Co-Founder, dnnGallery
Stack Overflow: Ian Robinson
Twitter: @irobinson
Linked In: Ian Robinson
 
New Post
1/18/2009 8:22 PM
 

Ian,


That did it! 

 

Thanks, I really appreaciate the help.  That issue was a pretty big thorn in my side.

 

Kev

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Changing Gridview Text Font Size on RowDataBoundChanging Gridview Text Font Size on RowDataBound


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out