Wednesday, July 8, 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");
if(obj[i].type=="radio" && obj[i].checked==true)
{ alert('Plz Select question Answer');
return false
return true;


Wednesday, May 27, 2009

Get Rss data using javascript

Place bellow script in header part

for javascript file go to

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

type: "GET",
url: "",
dataType: "xml",
success: function(xml) {
var str="";


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(
}); //close $.ajax(
$("#msg").ajaxError(function(event, request, settings){
$(this).append("Error requesting page " + settings.url + "");

}); //close $(


Place bellow html part in body tab

[sourcecode language="html"]

<Table id='update-target'>

<div id=msg></div>

Tuesday, March 24, 2009

job scheduling which work at time interval in web application in

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


Wednesday, January 14, 2009

Saturday, January 3, 2009

Color char in any string

string name = "hello vinod how r u";

Random rd=new Random();

CharEnumerator ct = name.GetEnumerator();
while (ct.MoveNext())

int r = rd.Next(0, 255);
int g = rd.Next(0, 255);
int b = rd.Next(0, 255);
string rgb = r.ToString() + "," + g.ToString() + "," + b.ToString();
Response.Write("<span style='color:rgb(" + rgb + ");font-weight:bold;font-family:Verdana;font-size:15px'>" + ct.Current + "</span><br />");

nesting repeater in datalist (slider menu)

put in head tag

<script src="js/jquery-1.2.6.min.js" type="text/javascript"></script>
<script language=javascript>
function show(id)
var tc=document.getElementById("tot").value;
for(var i=1;i<=tc;i++)

// window.onload=show('div1')

in body tag
<asp:HiddenField ID="tot" runat=server />
<asp:DataList ID="dl_cat" runat=server >
<div style="color:white;font-size:13px;font-weight:bold;cursor:pointer;width:250px;height:20px;background-color:Gray;padding-bottom:3px;padding-top:3px;padding-left:5px" onclick="show('div<%#Container.ItemIndex+1%>')" >
<%#Eval("categoryname") %>
<div id='div<%#Container.ItemIndex+1%>' style="background-color:Yellow;display:none">
<asp:Repeater ID="rp_subcat" DataSource='<%#DataBinder.Eval(Container, "DataItem.InnerVal") %>' runat=server >
<span style="padding-left:10px"><%#Eval("productname") %></span><br />
protected void Page_Load(object sender, EventArgs e)

DataAccessLayer dl = new DataAccessLayer();
DataSet ds = new DataSet();
dl.RunProcedure("cate_product", ref ds);
ds.Relations.Add("InnerVal", ds.Tables[0].Columns["categoryid"], ds.Tables[1].Columns["categoryid"]);
tot.Value = ds.Tables[0].Rows.Count.ToString();
dl_cat.DataSource = ds.Tables[0];

CREATE PROCEDURE [dbo].[cate_product]


select c.categoryid,c.categoryname,p.productid,p.productname into #tamp  from categories c

inner join products p on c.categoryid=p.categoryid

select distinct categoryid,categoryname from #tamp

select categoryid,productname from #tamp

drop table #tamp
AJAX, asp,, and sql server security, IntemIndex, C#, Css, DataBinder.Eval, DataKeyNames, Datalist, Datapager, DataSet, DataTable, DropDownList, FindControl, gridview, JavaScript, jquery, Listview, Paging, Regex, RegularExpression, Repeater, Server side validation, Sql Server, timer, timercallback, Validation, XML, xmlnode, XPath