Monday, February 21, 2011

How to use ajax animation extender

<style type="text/css">.flyOutDiv{display: none; position: absolute; width: 400px; z-index: 3; opacity: 0; filter: (progid: DXImageTransform.Microsoft.Alpha(opacity=0)); font-size: 18px; border: solid 1px #FFFFFF; background-color: #FFFFFF; padding
}
: 5px;.flyOutDivCloseX{background-color: #666666; color: #FFFFFF; text-align: center; font-weight: bold; text-decoration: none; border: outset thin #FFFFFF; padding
}
: 5px; </style>

Monday, February 7, 2011

How to do paging in Datalist Control in asp.net

In Design page add two link button and a data list control i.e ".aspx" page


<asp:LinkButton ID="lnkPrevious" CssClass="footertxt" runat="server" onclick="lnkPrevious_Click">Previous</asp:LinkButton>&nbsp;
<asp:LinkButton ID="lnkNext" runat="server" CssClass="footertxt" onclick="lnkNext_Click">Next</asp:LinkButton>
<asp:DataList ID="DataList1" runat="server" RepeatColumns="3"
<ItemTemplate>
"In this section add your design "
</ItemTemplate>
</asp:DataList>
 Now in .cs file write code given as :
public partial class test: System.Web.UI.Page
{
SqlDataAdapter da;
DataSet ds;
string conn;
static DataTable dt;
PagedDataSource pds;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
BindGrid();
}
public void BindGrid()
{
string conn = ConfigurationManager.ConnectionStrings["yourconnectioname"].ConnectionString;
string sql="Select * from Tbl_FreeRegister" ;
da = new SqlDataAdapter(sql, conn);
dt = new DataTable();
da.Fill(dt);
pds = new PagedDataSource();
pds.DataSource = dt.DefaultView;
pds.AllowPaging = true;
pds.PageSize = 9;
pds.CurrentPageIndex = CurrentPage;
lnkbtnPrevious.Enabled = !pds.IsFirstPage;
lnkbtnNext.Enabled = !pds.IsLastPage;
DataList1.DataSource = pds;
DataList1.DataBind();
}
//Define Property
public int CurrentPage
{
get
{
if (this.ViewState["CurrentPage"] == null)
return 0;
else
return Convert.ToInt16(this.ViewState["CurrentPage"].ToString());
}
set
{
this.ViewState["CurrentPage"] = value;
}
}
//linkbutton click event
protected void lnkPrevious_Click(object sender, EventArgs e)
{
CurrentPage -=1;
BindGrid();
}
protected void lnkNext_Click(object sender, EventArgs e)
{
CurrentPage += 1;
BindGrid();
}
}

Sunday, February 6, 2011

Select MAX no from particular column in SQL Server or MAX fuction

If we have a table design like as :




Alter table command
alter table table_name alter column membership_no int

select MAX(membership_no) as Membership from table_name