Wednesday, 8 July 2009

Validate radio button in datagrid, datalist, gridview on button

Here  'questionlist' is the id of Datalist or datagrid or Gridview or repeater

u call this function on button events

<button onclick="return isconfirm()" />

<script language=javascript>
function isconfirm()
{

var counter=0;

var obj=document.getElementById("<%=questionlist.ClientID%>").getElementsByTagName("input");
for(i=0;i<=obj.length-1;i++)
{
if(obj[i].type=="radio" && obj[i].checked==true)
{
counter++;
}
}
if(counter==0)
{ alert('Plz Select question Answer');
return false
}
return true;
}

</script>
Share:

Tuesday, 26 May 2009

Get Rss data using javascript

Place bellow script in header part

for javascript file go to http://jquery.com

<script src="js/jquery-1.2.6.min.js" type="text/javascript"></script>
<script type="text/javascript" language=javascript>
$(document).ready(function() {

$.ajax({
type: "GET",
url: "http://yourdomain.com/rss.xml",
dataType: "xml",
success: function(xml) {
$('#update-target').empty();
var str="";

$(xml).find('item').each(function(){

var title = $(this).find('title').text()
var link = $(this).find('link').text()
var desc = $(this).find('description').text()
str +="<tr><td><a href='"+link+"' >"+title+"</a><br />";
str+="<a href='"+link+"' >"+desc.substring(0,100)+"...</a></td></tr>";

}); //close each(
$('#update-target').html(str);
}
}); //close $.ajax(
$("#msg").ajaxError(function(event, request, settings){
$(this).append("Error requesting page " + settings.url + "");
});

}); //close $(
</script>

[/sourcecode]

Place bellow html part in body tab

[sourcecode language="html"]

<Table id='update-target'>

</Table>
<div id=msg></div>
Share:

Tuesday, 24 March 2009

job scheduling which work at time interval in web application in asp.net

I am created that type of schedule which work properly. if that is helpfull for u then u appreciate it.

using System.Threading;

as namespace

following add in global.asax.cs

protected static Timer _timer;

protected void Application_Start(object sender, EventArgs e)
{
if (_timer == null)
{
var timerCallback = new TimerCallback(JobModulecls.jobshedule);//jobschedule is method which define in JobModulecls class as static method
var startTime = 0;
var interval = 60000; // 60 seconds
_timer = new Timer(timerCallback, null, startTime, interval);
}

}

protected void Application_End(object sender, EventArgs e)
{
_timer = null;
}

public sealed class JobModulecls
{
public static void jobshedule(object state)
{
//here u can write job shcheduling work such as
// coonect to database and work on table on time day schedule

}
}
Share: