Expand DIV using jquery
Hi All,
Here you can get the idea about the expanding of div inside an master page or any other pages. This has some animation. That is if you click on the Login Link then the below login tab will be open with some animation.
Here you may find the style used for this sample in style tag. Please have a look at the following coding,
This should be inside the head tag.
<script src="js/jquery-1.2.6.min.js" type="text/javascript"></script>
<style type="text/css" media="screen">
#expand
{
display: none;
background-color: Transparent;
position: absolute;
z-index: 100; /* padding: 16px;
background-color: Blue;
z-index: 1000;
width:350px; */
}
.expandInfo
{
background-color: Transparent;
margin: 0;
padding: 0px;
}
</style>
<script type="text/javascript">
<!--
$(function () {
$('.expandInfo a').click(function () {
$('#expand').slideToggle(1500);
return false;
});
})
//-->
</script>
<script type="text/javascript">
<!--
$(function () {
$('.expandInfoClose a').click(function () {
$('#expand').slideToggle(1500);
return false;
});
})
//-->
</script>
Then the body content may be as follows,
<div class="bg">
<p class="expandInfo">
<a href="#home" title="Login" class="login" style="width: 100px; height: 100px;">Login</a>
</p><br />
<br />
<div id="expand"><table cellpadding="0" cellspacing="0" class="loginbg">
<tr>
<td valign="top" style="padding-left: 30px">
<div style="float: right; padding-right: 10px">
<p class="expandInfoClose">
<a href="#home" title="Close">
<asp:Image runat="server" ID="imgcloselog" SkinID="imgLoginBoxClose" />
</a>
</p>
</div>
<asp:Panel runat="server" ID="pnlLoginMaster" DefaultButton="btnLogin">
<table cellpadding="4" cellspacing="4" align="left" style="margin-top: 60px;">
<tr>
<td align="left" valign="top">
<%--// CONTENTS--%>
cellspacingcellspacingcellsp acingcellspacing cellspacing cellspacingcells pacingcellspacingcellspacing
cellspacing cellsp acing cellspa cingcellspa cingcel lspacingce llsp acing
</td>
</tr>
</table>
</asp:Panel>
</td>
</tr>
</table>
</div>
</div>
You can download the jquery here
If you have any questions please feel free to post comments....
Suggessions always welcome ..........Happy coding!!!!!!!
Meet you again!!!!!!!!
Labels: .NET, animation, div expand, div hide, jquery, JS, textbox 0 Comments
Get Top 1 Record from Dataset
Hi Guys,
Many of them in need of getting the Top 1 or Top 10 records from a Dataset without going to SQL query. It is possible to do from Code Behind. I have given the code below,
The below code is to get single record from a Dataset. Also I have given for getting 8 records at Green Color.
public DataSet GetTopTen(DataSet ds)
{
try
{
DataView dv = ds.Tables[0].DefaultView;
dv.Sort = "ModifiedDatetime DESC";
DataSet dss = new DataSet();
DataTable dt = dv.Table.Clone();
dss.Tables.Add(dt);
// This is To get 8 records
//int counter = 0;
//if (dv.Count > 8)
// counter = 8;
//else
// counter = dv.Count;
//for (int i = 0; i < counter; i++)
//{
// DataRow dv = dv[i].Row;
// dss.Tables[0].ImportRow(dv);
//}
// This is for Getting only one Record
DataRow dv = dv[0].Row;
dss.Tables[0].ImportRow(dv);
dss.AcceptChanges();
return (dss);
}
catch (Exception e)
{
throw e;
}
}
Hope this will help you Guys.... Please touch with this blog... I will update regularly....
Labels: .NET, 1 record, Dataset, datatable, dataview, getting records, top 1 record 0 Comments
Email Validation from Codebehind
This is for check the email address from codebehind using regular expression.
if (System.Text.RegularExpressions.Regex.IsMatch(txtNewsletter.Text, "^([0-9a-zA-Z]([-.\\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\\w]*[0-9a-zA-Z]\\.)+[a-zA-Z]{1,3})$") == false)
{
Page.RegisterStartupScript("GetType", "<script language='javascript'>alert('Please enter valid email address!')</script>'");
}
Labels: email validation, javascript, JS, regular expression 0 Comments
watermark textbox using Ajax control
This is pretty simple compared to jquery. Since we need refer a dll only. we dont want any script for this. we just include that reference into our website.
Please have a look at the coding.......
<asp:TextBox runat="server" ID="txtSearch"></asp:TextBox>
<ajaxToolkit:TextBoxWatermarkExtender ID="twSearch" runat="server" TargetControlID="txtSearch"
WatermarkText="Search Products..." />
<span class="search_button">
<asp:ImageButton ID="butSearch1" runat="server" ImageAlign="Right" OnClick="butSearch1_Click"
Height="30px" />
</span>
Labels: .NET, ajax, ajax textbox, DOT Net, Tips, watermark 0 Comments
Watermark Textbox using jquery
Here is the coding for Watermark inside a textbox. That is initially the message will show inside the textbox. Once you click on the textbox it will disappear. This is used by jquery.
CSS:
<style type="text/css" media="screen">
.water
{
font-family: Tahoma, Arial, sans-serif;
color: blue;
}
</style>
SCRIPT:
<script src="js/jquery-1.2.6.min.js" type="text/javascript"></script>
DESIGN:
<div>
<h2>
Watermarked TextBox </h2>
<br />
<asp:TextBox ID="txtFirstName" class="water" Text="Enter First Name" ToolTip="Enter First Name" runat="server"></asp:TextBox><br />
<asp:TextBox ID="txtLastName" class="water" Text="Enter Last Name" ToolTip="Enter Last Name" runat="server"></asp:TextBox> <br />
<asp:Button ID="btnSubmit" runat="server" Text="Submit" ValidationGroup="vgNews" /></div>
Please give your comments if you need any clarification.... Also I will post watermark using ajax in the next post... Happy Coding!!!
If you need this Jquery please click here to download
Create XML file
Hi All,
Here I have given the sample code to create a simple XML from .NET.
Please post your comments after review this....
string strfile = Server.MapPath("~/App_Data/simplexmlcreation.xml");
XmlTextWriter writexml = new XmlTextWriter(strfile, System.Text.Encoding.UTF8);
try
{
// write the top element and encode type
writexml.WriteStartDocument();
// write the starting element or root element
writexml.WriteStartElement("IPL");
// write first set of records
writexml.WriteStartElement("team");
// write the attributes
writexml.WriteAttributeString("Name", "Chennai Super Kings");
writexml.WriteAttributeString("Points", "40");
writexml.WriteAttributeString("Captain", "Raina");
writexml.WriteString("CSK HAS MATHEW HAYDEN");
writexml.WriteEndElement();
//// write Second set of records
writexml.WriteStartElement("team");
// write the attributes
writexml.WriteAttributeString("Name", "Kolkatta Knight Riders");
writexml.WriteAttributeString("Points", "45");
writexml.WriteAttributeString("Captain", "Saurav");
writexml.WriteString("KKR HAS Saurav Ganguly");
writexml.WriteEndElement();
//// write Third set of records
writexml.WriteStartElement("team");
// write the attributes
writexml.WriteAttributeString("Name", "Royal Challangers Bangalore");
writexml.WriteAttributeString("Points", "55");
writexml.WriteAttributeString("Captain", "Kumble");
writexml.WriteString("KKR HAS Kalis");
writexml.WriteEndElement();
// Close the root Element
writexml.WriteEndElement();
//close the XML DOC
writexml.WriteEndDocument();
}
catch
{
throw;
}
finally
{
writexml.Close();
}
Thanks for reading my POST..... Keep Coding!!!!!!!
Labels: .NET, DOT Net 0 Comments
AUTHENTICATION and AUTHORIZATION
The web.config file has all of the configuration settings on an Application.
Authentication is the process of determining the authenticity of a user based on the user’s credentials.
Whenever a user logs in to an application, the user is first authenticated and then authorized.
1. Forms Authentication
2. Windows Authentication
3. Passport Authentication
You can set it in the web.config file as below,
1. Forms Authentication:
This type of authentication is based on cookies. The username and password is stored in Database.This Forms authentication supports both Session and Cookies.
If the cookie isn't present, ASP.NET redirects the user to a web form you provide.
SYNTAX:
2. Windows Authentication:
This type of authentication is default one. Here a user can authenticated by their own windows account. So that this kind of Authentication is used only for Intranet not for web.
SYNTAX:
3. Passport Authnetication:
This passport authentication is the authentication service that uses the Microsoft's Passport Services. It allows the user to create a single sign in name and password to authenticated.
SYNTAX:
AUTHORIZATION:
It is the process of finding the accessibilty for a previously authenticated user.Authorization is only works with the Authenticated User/Person.
Labels: .NET, DOT Net 0 Comments


Recent Comments