Hello All,
I want to change the size of my hyper lnks in a repeater control dynamially
using the onItemBound event, as under, but cannot seem to understand how to
alter the properties to do that.
<asp:HiddenField ID="maxFrequency" runat="server" />
<ASP:Repeater id="repTags" runat="server" OnItemDataBound="ShowFrequery" >
<ItemTemplate>
<a id="lnkFeedTags" href='<%# "../resources/showentries.aspx?strTag=" +
Server.UrlEncode((((DataRowView)Container.DataItem )["sTag"]).ToString())%>'
runat="server" ><%# DataBinder.Eval(Container.DataItem,
"sTag").ToString()%></a>
<asp:HiddenField ID="lnkFeedFrequency" runat="server" Value='<%#
DataBinder.Eval(Container.DataItem, "nTagsCount").ToString()%>'/>
</ItemTemplate>
</ASP:Repeater>
Code behind is
public void ShowFrequery(Object sender, RepeaterItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType ==
ListItemType.AlternatingItem)
{
string strValue =
((HiddenField)e.Item.FindControl("lnkFeedFrequency ")).Value;
string strMax = maxFrequency.Value;
if ((strValue != "") && (strMax != ""))
{
string strSize = string.Empty;
int frqSize = (int.Parse(strValue) / int.Parse(maxFrequency.Value)) * 7;
switch (frqSize)
{
case 1: strSize = "x-small";
break;
case 2: strSize = "small";
break;
case 3: strSize = "smaller";
break;
case 4: strSize = "medium";
break;
case 5: strSize = "larger";
break;
case 6: strSize = "large";
break;
case 7: strSize = "x-large";
break;
default: strSize = "x-small";
break;
}
Style s = new Style();
((HyperLink)e.Item.FindControl("lnkFeedTags")).Mer geStyle(string) =
"font-size:" + strSize;
}
}
}
Thanks a lot,
Imran. 2 2009
I would look to change the name of the CSS class the link uses, then setup
CSS classes with these different styles, rather than use MergeStyle.
--
Clint Hill MCAD
H3O Software http://www.h3osoftware.com
"Imran Aziz" wrote: Hello All,
I want to change the size of my hyper lnks in a repeater control dynamially using the onItemBound event, as under, but cannot seem to understand how to alter the properties to do that. <asp:HiddenField ID="maxFrequency" runat="server" />
<ASP:Repeater id="repTags" runat="server" OnItemDataBound="ShowFrequery" >
<ItemTemplate>
<a id="lnkFeedTags" href='<%# "../resources/showentries.aspx?strTag=" + Server.UrlEncode((((DataRowView)Container.DataItem )["sTag"]).ToString())%>' runat="server" ><%# DataBinder.Eval(Container.DataItem, "sTag").ToString()%></a>
<asp:HiddenField ID="lnkFeedFrequency" runat="server" Value='<%# DataBinder.Eval(Container.DataItem, "nTagsCount").ToString()%>'/>
</ItemTemplate>
</ASP:Repeater>
Code behind is
public void ShowFrequery(Object sender, RepeaterItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
string strValue = ((HiddenField)e.Item.FindControl("lnkFeedFrequency ")).Value;
string strMax = maxFrequency.Value;
if ((strValue != "") && (strMax != ""))
{
string strSize = string.Empty;
int frqSize = (int.Parse(strValue) / int.Parse(maxFrequency.Value)) * 7;
switch (frqSize)
{
case 1: strSize = "x-small";
break;
case 2: strSize = "small";
break;
case 3: strSize = "smaller";
break;
case 4: strSize = "medium";
break;
case 5: strSize = "larger";
break;
case 6: strSize = "large";
break;
case 7: strSize = "x-large";
break;
default: strSize = "x-small";
break;
}
Style s = new Style();
((HyperLink)e.Item.FindControl("lnkFeedTags")).Mer geStyle(string) = "font-size:" + strSize;
}
} } Thanks a lot,
Imran.
Thanks Clint Hill, that was a quick and good solution, worked great thanks.
Imran.
"Clint Hill" <cl********@nospamath3osoftware.com> wrote in message
news:CE**********************************@microsof t.com... I would look to change the name of the CSS class the link uses, then setup CSS classes with these different styles, rather than use MergeStyle. -- Clint Hill MCAD H3O Software http://www.h3osoftware.com
"Imran Aziz" wrote:
Hello All,
I want to change the size of my hyper lnks in a repeater control dynamially using the onItemBound event, as under, but cannot seem to understand how to alter the properties to do that. <asp:HiddenField ID="maxFrequency" runat="server" />
<ASP:Repeater id="repTags" runat="server" OnItemDataBound="ShowFrequery" >
<ItemTemplate>
<a id="lnkFeedTags" href='<%# "../resources/showentries.aspx?strTag=" + Server.UrlEncode((((DataRowView)Container.DataItem )["sTag"]).ToString())%>' runat="server" ><%# DataBinder.Eval(Container.DataItem, "sTag").ToString()%></a>
<asp:HiddenField ID="lnkFeedFrequency" runat="server" Value='<%# DataBinder.Eval(Container.DataItem, "nTagsCount").ToString()%>'/>
</ItemTemplate>
</ASP:Repeater>
Code behind is
public void ShowFrequery(Object sender, RepeaterItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
string strValue = ((HiddenField)e.Item.FindControl("lnkFeedFrequency ")).Value;
string strMax = maxFrequency.Value;
if ((strValue != "") && (strMax != ""))
{
string strSize = string.Empty;
int frqSize = (int.Parse(strValue) / int.Parse(maxFrequency.Value)) * 7;
switch (frqSize)
{
case 1: strSize = "x-small";
break;
case 2: strSize = "small";
break;
case 3: strSize = "smaller";
break;
case 4: strSize = "medium";
break;
case 5: strSize = "larger";
break;
case 6: strSize = "large";
break;
case 7: strSize = "x-large";
break;
default: strSize = "x-small";
break;
}
Style s = new Style();
((HyperLink)e.Item.FindControl("lnkFeedTags")).Mer geStyle(string) = "font-size:" + strSize;
}
} } Thanks a lot,
Imran. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: TheKeith |
last post by:
I don't know much about javascript, so take it easy on me. Is there a way to
dynamically change a CSS layers dimensions on the fly. Here is what I'm
doing. I have a bunch of thumbnails that when...
|
by: Tim_Mac |
last post by:
hi,
i have a list of hyperlinks (server-side generated), that have a href
value as follows:
href="javascript:AsyncRequest('someurl.asmx?..',this)"
since the url is loaded asynchronously, i need...
|
by: Robbo |
last post by:
Hello, I created a datagrid with a few hyperlink columns.. How do i change
the color of the hyperlink itself? BLUE is a bit bad on my datagrid
color scheme.
Thanks,
Rob
|
by: Robson Carvalho Machado |
last post by:
Dear friends,
I'm dynamically creating a Hyperlink with spacer.gif as ImageURL that is an
1px transparent image only to determine link position, but as I create this
link dynamically I could not...
|
by: RA |
last post by:
While dynamically creating the table; I am adding a hyperlink as a TableCell
where text is "Delete". Initially it is disabled and if a checkbox is
selected from a table then it gets enabled. Even...
|
by: Tomek R. |
last post by:
Hello !
This post does'nt regard column hyperlink.
I just have single hyperlink and want to create it's NavigateUrl
dynamically.
This is my test page
<form id="Form1" method="post"...
|
by: sloesch |
last post by:
I am working with VS.net 2003, framework 1.1, developing with VB.net,
and ASP.net, and I would like to know how you can create a dynamic
hyperlink on the fly to a document stored in a SQL database?...
|
by: =?Utf-8?B?Um9nZXI=?= |
last post by:
In my app I would like to change the color of the hyperlink from blue to
purple when a user clicks the hyperlink in a RichTextBox.
The DetectUrls property is set to True and I handle the...
|
by: webster5u |
last post by:
Hi, I'm encounter a problem here. I hope somebody able helping me.
i'm put a "log out" hyperlink overlap a image and that particular image is inside a table cell. I also try align the hyperlink on...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |