Tuesday, August 9, 2011

Response and Redirect

Page.ClientScript.RegisterStartupScript(typeof(Page), "key", "<script>alert('Updated Successfully.');location.href=\"cardsManagment.aspx\";</script>");


Response.Write("<script>alert('Thankyou for your interest. We will get in touch with you shortly.')</script>");

Friday, August 5, 2011

Bookmarked link

http://dotnetslackers.com/articles/sql/SQL-SERVER-JOINs.aspx#inner-join
http://geekswithblogs.net/dotNETvinz/archive/2009/02/22/gridview-insert-edit-update-and-delete--the-ado.net-way.aspx
http://www.codeproject.com/KB/aspnet/InsertingWithGridView.aspx
http://weblogs.asp.net/manojkdotnet/archive/2009/10/11/insert-update-and-delete-using-grid-view-and-objectdatasource.aspx
http://csharpdotnetfreak.blogspot.com/2009/05/gridview-sqldatasource-insert-edit.html

http://community.devexpress.com/blogs/aspnet/archive/2011/07/01/asp-net-gridview-how-to-add-multiple-check-box-column-filter.aspx
http://forum.codecall.net/csharp-tutorials/20405-c-tutorial-creating-personal-weather-app.html
http://marcgrabanski.com/articles/jquery-ui-datepickers
http://trentrichardson.com/examples/timepicker
http://www.web-delicious.com/jquery-plugins
http://puna.net.nz/timepicker.htm
http://www.mediachase.com/FileUploader2/documentation/lesson3.html
HTml color code

Play with sql

Jquery calender in asp.net

1 . http://trentrichardson.com/examples/timepicker/


2.Place your js and css code file in head oft he plugin
<style type="text/css">
<link rel="stylesheet" media="all" type="text/css" href="http://trentrichardson.com/examples/timepicker/css/ui-lightness/jquery-ui-1.8.14.custom.css" />
body,img,p,h1,h2,h3,h4,h5,h6,form,table,td,ul,li,dl,dt,dd,pre,blockquote,fieldset,label{
margin:0;
padding:0;
border:0;
}
body{ background-color: #363531; border-top: solid 4px #C60; font: 90% Arial, Helvetica, sans-serif; padding: 20px; }
h1,h2{ margin: 10px 0; }
p{ margin: 10px 0; }
pre{ padding: 20px; background-color: #ffffcc; border: solid 1px #fff;display:none }
.wrapper{ background-color: #ffffff; width: 800px; border: solid 1px #eeeeee; padding: 20px; margin: 0 auto; }
.example-container{ background-color: #f4f4f4; border-bottom: solid 2px #777777;}
.example-container p{ font-weight: bold; }
.example-container dt{ font-weight: bold; height: 20px; }
.example-container dd{ margin: -20px 0 10px 100px; border-bottom: solid 1px #fff; }
.example-container input{ width: 150px; }
.clear{ clear: both; }
#ui-datepicker-div{ font-size: 80%; }
/* css for timepicker */
.ui-timepicker-div .ui-widget-header{ margin-bottom: 8px; }
.ui-timepicker-div dl{ text-align: left; }
.ui-timepicker-div dl dt{ height: 25px; }
.ui-timepicker-div dl dd{ margin: -25px 10px 10px 65px; }
.ui-timepicker-div td { font-size: 90%; }
</style>
<%--http://trentrichardson.com/examples/timepicker/js/jquery-1.5.1.min.js--%>
<script type="text/javascript" src="../timepicker/jquery-1.5.1.min.js"></script>
<script type="text/javascript" src="../timepicker/jquery-ui-1.8.14.custom.min.js"></script>
<script type="text/javascript" src="../timepicker/jquery-ui-timepicker-addon.js"></script>
<script type="text/javascript"> $(function(){
$('.example-container > pre').each(function(i){
eval($(this).text());
});
});
</script>


<script type="text/javascript" src="view-source:http://trentrichardson.com/examples/timepicker/js/jquery-1.5.1.min.js"></script>
<script type="text/javascript" src="view-source:http://trentrichardson.com/examples/timepicker/js/jquery-ui-1.8.14.custom.min.js"></script>
<script type="text/javascript" src="view-source:http://trentrichardson.com/examples/timepicker/js/jquery-ui-timepicker-addon.js"></script>

<script type="text/javascript">
$(function(){
$('.example-container > pre').each(function(i){
eval($(this).text());
});
});
</script>


3.Place the input control in body

<div class="example-container"><div><asp:TextBox type="text" name="example2" id="example2" value="" runat="server" ></asp:TextBox></div></div>
<pre>
$('#ctl00_ContentPlaceHolder1_taskinsert_ctl12_example2').datetimepicker({
ampm: true,
minDate: 0,
maxDate: 30
});

</pre>



Wednesday, August 3, 2011

alert Message

1.You will get alert box

Response.Write("<html><head><script language=javascript>alert('No Record Available..')</script></head></html<");

Populating dropdownlist

On .aspx page dropdown code
<asp:DropDownList ID="ddlsearchempgrid" AutoPostBack="true"
runat="server"><asp:ListItem Selected="True" Value="-Select-">-Select-</asp:ListItem>
</asp:DropDownList>

On .Cs page dropdown code


protected void binddropdownprj()
{
SqlConnection con = new SqlConnection(ConfigurationManager.AppSettings["Enigma"].ToString().Trim());
SqlDataAdapter da = new SqlDataAdapter("select * from cProject", con);
DataSet ds = new DataSet();
da.Fill(ds);
if (ds.Tables[0].Rows.Count > 0)
{
ddlproject.DataSource = ds.Tables[0];
ddlproject.DataTextField = "createproject";
ddlproject.DataValueField = "ProjectId";
ddlproject.DataBind();
ddlproject.Items.Insert(0, new ListItem("-Select-"));

}
}

And On Page dropdown code


protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{

binddropdownprj();
}
}


2.

Populating Dropdown Inside Gridview



On buttun code use onselectedindexchanged="" and then create this method on serverside.

if (e.Row.RowType == DataControlRowType.Header)
{
SqlConnection con = new SqlConnection(ConfigurationManager.AppSettings["Enigma"].ToString().Trim());
SqlDataAdapter da = new SqlDataAdapter("Select * From Empdetail", con);
DataSet ds = new DataSet();
da.Fill(ds);
da.SelectCommand.CommandText = "select * from cProject ";
da.Fill(ds, "cproject");

if (ds.Tables[0].Rows.Count > 0)
{

DropDownList ddlgridfilter = new DropDownList();
ddlgridfilter = (DropDownList)e.Row.FindControl("ddlsearchempgrid");
ddlgridfilter.DataSource = ds.Tables[0];
ddlgridfilter.DataTextField = "EmpCode";
ddlgridfilter.DataValueField = "EmpCode";
ddlgridfilter.DataBind();
Dropdown list populating project currently not in correct format.


}
if (ds.Tables[1].Rows.Count > 0)
{
DropDownList ddlgrprj = new DropDownList();
ddlgrprj = (DropDownList)e.Row.FindControl("ddlproject");
ddlgrprj.DataSource = ds.Tables[1];
ddlgrprj.DataTextField = "createproject";
ddlgrprj.DataValueField = "ProjectId";
ddlgrprj.DataBind();
}

}



To Catch event when text changed of dropdown





protected void ddlprogress_SelectedIndexChanged(object sender, EventArgs e)
{
DropDownList dd=(DropDownList)viewtsk.HeaderRow.FindControl("ddlprogress");
dd1=dd.SelectedItem.Text;
string Eprg = ddlprogress.SelectedValue.ToString().Trim();
string Eprg = ((DropDownList)viewtsk.HeaderRow.FindControl("ddlprogress")).SelectedValue.ToString().Trim();
SqlConnection con = new SqlConnection(ConfigurationManager.AppSettings["Enigma"].ToString().Trim());
SqlDataAdapter dagrid = new SqlDataAdapter("select e.status,e.taskId,e.project,e.task,e.description,f.EmpCode from taskdetails e inner join Empdetail f on f.EmpCode = e.EmpCode where e.status='" + Eprg + "'", con);
DataSet dt = new DataSet();
dagrid.Fill(dt);
if (dt.Tables[0].Rows.Count > 0)
{

viewtsk.DataSource = dt;
viewtsk.DataBind();

}
}

Monday, August 1, 2011

Gidview Css

1.Open Notepad and paste the style given below.


.GridViewStyle
{
font-family: Arial, Sans-Serif;
font-size:small;
table-layout: auto;
border-collapse: collapse;
border: #1d1d1d 5px solid;
}
/*Header and Pager styles*/
.HeaderStyle, .PagerStyle /*Common Styles*/
{
background-image: url(Images/HeaderGlassBlack.jpg);
background-position:center;
background-repeat:repeat-x;
background-color:#1d1d1d;
}
.HeaderStyle th
{
padding: 5px;
color: #ffffff;
}
.HeaderStyle a
{
text-decoration:none;
color:#ffffff;
display:block;
text-align:left;
font-weight:normal;
}
.PagerStyle table
{
text-align:center;
margin:auto;
}
.PagerStyle table td
{
border:0px;
padding:5px;
}
.PagerStyle td
{
border-top: #1d1d1d 3px solid;
}
.PagerStyle a
{
color:#ffffff;
text-decoration:none;
padding:2px 10px 2px 10px;
border-top:solid 1px #777777;
border-right:solid 1px #333333;
border-bottom:solid 1px #333333;
border-left:solid 1px #777777;
}
.PagerStyle span
{
font-weight:bold;
color:#FFFFFF;
text-decoration:none;
padding:2px 10px 2px 10px;
}
/*RowStyles*/
.RowStyle td, .AltRowStyle td, .SelectedRowStyle td, .EditRowStyle td /*Common Styles*/
{
padding: 5px;
border-right: solid 1px #1d1d1d;
}
.RowStyle td
{
background-color: #c9c9c9;
}
.AltRowStyle td
{
background-color: #f0f0f0;
}
.SelectedRowStyle td
{
background-color: #ffff66;
}

2.Save it .js Type.
3.Use this like this in header edit the src location.
4.And Gridview design

<asp:GridView ID="viewtsk" runat="server" AutoGenerateColumns="false" OnRowCommand="viewtsk_RowCommand"
OnRowDataBound="viewtsk_RowDataBound" AllowPaging="True" OnPageIndexChanging="viewtsk_PageIndexChanging">
<RowStyle CssClass="RowStyle" />

<PagerStyle CssClass="PagerStyle" />
<SelectedRowStyle CssClass="SelectedRowStyle" />
<HeaderStyle CssClass="HeaderStyle" />
<EditRowStyle CssClass="EditRowStyle" />
<AlternatingRowStyle CssClass="AltRowStyle" />