Thursday, November 20, 2008

Get User Control Value inside .ASPX page

<%@ Control Language="C#" AutoEventWireup="true"

CodeFile="header.ascx.cs" Inherits="UserControl_header" %>

on aspx pages-----------------

incode berhind pages-----------
protected void Page_Load(object sender, EventArgs e)
UserControl huser = header1 as UserControl;

searchlog(ref huser, "text for search");

void searchlog(ref UserControl hd, string text)
Label lb = (Label)hd.FindControl("lbltext");
TextBox txtbox = (TextBox)hd.FindControl("searchtext");
//here i assign text to usercontrol label
lb.Text = text;

//here i write user control text box value on page
Response.Write("User Control Textbox value::" +



search record from table at given date

you pass date as varchar type and mm/dd/yyyy format

select * from emp where (createddate>'11/15/2008' and

createddate<DATEADD(day,1, '11/15/2008'))

remove any new line charactor from value of column

update emp set name=replace(name,char(10),'') where


remove any space from any value of column

update emp set name=replace(name,' ','') where charindex('


checking space or any charactor in value in any column

select name from emp where charindex(' ',name)>0
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