or some other way to show vertical news scroller showing the news from database,.
<
script type="text/javascript">
v_font=
'verdana,arial,sans-serif';
v_fontSize=
'10px';
v_fontSizeNS4=
'11px';
v_fontWeight=
'normal';
v_fontColor=
'#4A49A8';
v_textDecoration=
'none';
v_fontColorHover=
'#ff0000';// | won't work
v_textDecorationHover=
'underline';// | in Netscape4
v_bgColor=
'url(bg.jpg)';
// set [='transparent'] for transparent
// set [='url(image_source)'] for image
v_top=0;
// |
v_left=0;
// | defining
v_width=200;
// | the box
v_height=52;
// |
v_paddingTop=2;
v_paddingLeft=2;
v_position=
'relative';// absolute/relative
v_timeout=2500;
//1000 = 1 second
v_slideSpeed=30;
v_slideDirection=0;
//0=down-up;1=up-down
v_pauseOnMouseOver=
true;
// v2.2+ new below
v_slideStep=1;
//pixels
v_textAlign=
'left';// left/center/right
v_textVAlign=
'middle';// top/middle/bottom - won't work in Netscape4
// === 2 === THE CONTENT - ['href','text','target']
// Use '' for href to have no link item
v_content=[
[
'view_news.aspx?nid= &sreq="View"','
];
// ===
v_ua=navigator.userAgent;v_nS4=document.layers?1:0;v_iE=document.all&&!window.innerWidth&&v_ua.indexOf(
"MSIE")!=-1?1:0;v_oP=v_ua.indexOf("Opera")!=-1&&document.clear?1:0;v_oP7=v_oP&&document.appendChild?1:0;v_oP4=v_ua.indexOf("Opera")!=-1&&!document.clear;v_kN=v_ua.indexOf("Konqueror")!=-1&&parseFloat(v_ua.substring(v_ua.indexOf("Konqueror/")+10))<3.1?1:0;v_count=v_content.length;v_cur=1;v_cl=0;v_d=v_slideDirection?-1:1;v_TIM=0;v_fontSize2=v_nS4&&navigator.platform.toLowerCase().indexOf("win")!=-1?v_fontSizeNS4:v_fontSize;v_canPause=0;function v_getOS(a){return v_iE?document.all[a].style:v_nS4?document.layers["v_container"].document.layers[a]:document.getElementById(a).style};function v_start(){var o,px;o=v_getOS("v_1");px=v_oP&&!v_oP7||v_nS4?0:"px";if(parseInt(o.top)==v_paddingTop){v_canPause=1;if(v_count>1)v_TIM=setTimeout("v_canPause=0;v_slide()",v_timeout);return}o.top=(parseInt(o.top)-v_slideStep*v_d)*v_d>v_paddingTop*v_d?parseInt(o.top)-v_slideStep*v_d+px:v_paddingTop+px;if(v_oP&&o.visibility.toLowerCase()!="visible")o.visibility="visible";setTimeout("v_start()",v_slideSpeed)};function v_slide(){var o,o2,px;o=v_getOS("v_"+v_cur);o2=v_getOS("v_"+(v_cur
document.write(
"");v_temp="";document.write(v_temp);setTimeout("v_start()",1000);if(v_nS4)onresize=function(){location.reload()}}
Koteswararao MallisettiPosted Nov 2, 2010, 5:55 AM
Avoid the Repeater :--> with out repeater we can 't the data to the page /use the ajax methods do you have a knowledge on ajax?
but pure javascript we use to satisfy your Requirements
the modified scroll function is
function scroll() {
var tab = document.getElementById("tblScroll");
var frow=tab.rows[0].cells[0].innerHTML;
//alert(frow);
for (var x = tab.rows.length - 1; x >=3; x--) { //THIS IS NEW CODE I WAS ADD TO DISPLAY LIMITED NO OT ROW
//HERE I WANT TO SHOW ONLY 3 ROWS YOU GIVE YOUR NO.
tab.rows[x].style.display = 'none';
}
for (var x = 0; x < (tab.rows.length - 1); x++) { //alert(tab.rows[x].cells[0].innerText);
tab.rows[x].cells[0].innerHTML = tab.rows[x + 1].cells[0].innerHTML;
}
//alert("after loop"+frow);
tab.rows[tab.rows.length - 1].cells[0].innerHTML = frow;
timer = setTimeout("scroll()",1000);
}
TO STOP THE SCROLLING EFFECT:
clearTimeOut() function is builtin funtion to stop the timer and when the mouse leave the table we again start the timer
hyperlink is common i think you know how to put hyperlink in the Repeater item template
sapna yelapurePosted Apr 19, 2015, 5:19 AM
If I have already 2 news in database but now I want to put the new news at top ,how to do this ?
Koteswararao MallisettiPosted Nov 3, 2010, 9:10 AM
for the october month i am in the winner list can i except any thing form our forum
Mahesh ChandPosted Nov 3, 2010, 8:40 AM
Just to let you know, your hard work is highly appreciated.
Koteswararao MallisettiPosted Nov 3, 2010, 6:55 AM
ENJOY THE PROGRAMMING
BYE.
Anusha SrivastavaPosted Nov 3, 2010, 1:30 AM
Now its working as i want......
Anusha SrivastavaPosted Oct 29, 2010, 5:52 AM
But I don't wnt to use repeater control although ur code is running perfectly.
coz. as the no. of rows in the table increses the rows of repeter will also get increased n design of the page will get effectd and since it's the news i want the pouse on mouse over, n want to use the hyperlink instead of just the text ,
Seee what i hav done:
<asp:Repeater ID="rptnews" runat="server" OnItemDataBound="rptnews_ItemDataBound">
<HeaderTemplate>
<table id="tblScroll" width="100%" style="max-height: 5%">
HeaderTemplate>
<ItemTemplate>
<tr style="max-height: 5%">
<td width="100%" style="max-height: 5%">
<div style="padding: 5px; margin-top: 5px; background-color: #f6f6f6">
<%#DataBinder.Eval(Container.DataItem, "NewsDate")%>
<br />
<%#DataBinder.Eval(Container.DataItem, "NewsSubject")%>
<br />
<br />
<%--
<asp:HiddenField ID="hdnid" runat="server" Value='<%#DataBinder.Eval(Container.DataItem, "Id")%>' />
div>
td>
tr>
ItemTemplate>
<FooterTemplate>
table>FooterTemplate>
asp:Repeater>
and
///
/// Method for rptnews_ItemDataBound
///
///
///
///
#region "rptnews_ItemDataBound"
protected void rptnews_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
try
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
////HyperLink hlnkEdit = (HyperLink)e.Item.FindControl("hyplnkNews");
//HiddenField HdnId = (HiddenField)e.Item.FindControl("hdnid");
//int iNewsId = 0;
//iNewsId = Convert.ToInt32(HdnId.Value);
//string strDtlsUrl = "view_news.aspx?nid=" + iNewsId + "&sreq=View";
//hlnkEdit.NavigateUrl = strDtlsUrl;
}
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
private void bind()
{
BCI_NewsList oBCI_NewsList = new BCI_NewsList();
if (Session["MasterUserGroup"].ToString() == "101")
{
string strQryactive = "SELECT * from BCI_News where IsDeleted = 'False' and Status='True'";
oBCI_NewsList = BCI_NewsDB.GetListForNews(strQryactive, "Text");
rptnews.DataSource = oBCI_NewsList;
rptnews.DataBind();
}
}
Can we do this with a hyperlink....??
Koteswararao MallisettiPosted Oct 28, 2010, 8:22 AM
sorry for previous ans ,i am provide the full ans
des: in this solution i take one repeater control which hold the data base data in your terms news report (the data is filled in c# code ).in this repeater Row with one cell ,TO FILL THE REPEATER I USE GENEREAL DATASERVAR.ReadXml(path) method.
then c# is over we will go for javascript to scrolling effect and take a timer in javascript and every 1000 m.second we call the scroll function for this i am using emp.xml file i will give this file also
emp.xml:
javascrip cod:
function scroll() {
var tab = document.getElementById("tblScroll");
var fRowC=tab.rows[0].cells[0].innerHTML;
//alert(frow);
for(var x=0;x<(tab.rows.length -1);x++)
{ //alert(tab.rows[x].cells[0].innerText);
tab.rows[x].cells[0].innerHTML=tab.rows[x+1].cells[0].innerHTML;
}
//alert("after loop"+fRowC);
tab.rows[tab.rows.length - 1].cells[0].innerHTML = fRowC;
var timer = setTimeout("scroll()",1000);
}
THE ASP.NET CODE:
Koteswararao MallisettiPosted Oct 28, 2010, 7:26 AM
Anusha SrivastavaPosted Oct 28, 2010, 2:59 AM
i.e the news just witterover there I want to enter the news from sql .
Is there any way to pass database table values in the javascript.
Koteswararao MallisettiPosted Oct 27, 2010, 8:16 AM