Friday, November 27, 2009

Linq Use

public IQueryable BindQualificationDetail(int startRowIndex, int maximumRows)
{
var qulaificationTypes = from QD in Common.dataContext.QualificationDetails
where QD.UpdaterRef.Equals(User.Identity.Name)
orderby QD.UpdatedOn descending
select new
{
QD.ProfileID,
QD.QualificationDetails,
QD.UpdaterRef
};
ViewState["BindQualificationDetailRows"] = qulaificationTypes.Count();
return qulaificationTypes.Skip(startRowIndex).Take(maximumRows);
}
public int GetQualificationDetailCount()
{
return (int.Parse(ViewState["BindQualificationDetailRows"].ToString()));
}

Thursday, November 26, 2009

Coolite Intro

We are pleased to announce the release of the Coolite Toolkit Version 0.6. This release is the most feature packed Coolite Toolkit version to date and ships with 20+ new web controls, new Ajax functionality and dozens of new features to help impress your boss and clients.

New Features


Examples Explorer

Coolite Toolkit Examples Explorer We're thrilled with our new "Examples Explorer" and over time we will be filling the explorer with hundreds of working code samples. The explorer is a great place to jump start your introduction into the Coolite Toolkit and simplify adding new functionality to your own projects. Each example also includes a real time "Source Code" viewer, .zip download of the files and "Direct Link" option.

New Slate Theme

The popular ExtJS Slate Theme originally developed by J.C. Bize is now included along with the original "Default" and "Gray" Themes. Just set Theme="Slate" in your . As well, continuing with our commitmen

Thursday, November 12, 2009

Linq Carries Value from One PAge to another

private void BindForm()
{
MemberYear original = GetMemberYearDetail(Convert.ToByte(Request.QueryString["ID"]));

foreach (ListItem lst in drpState.Items)
{
long GeographicId = Convert.ToInt64(ViewState["GeographicId"].ToString());
if (GeographicId == Convert.ToInt16(lst.Value))
{
drpState.ClearSelection();
lst.Selected = true;

}
}

foreach (ListItem lst in drpConstituency.Items)
{
if (original.GeographicId == Convert.ToInt16(lst.Value))
{
drpConstituency.ClearSelection();
lst.Selected = true;
BindMemberProfile(Convert.ToInt64(drpConstituency.SelectedValue.ToString()));
}
}

foreach (ListItem lst in drpMember.Items)
{
if (original.ProfileId == Convert.ToInt16(lst.Value))
{
drpMember.ClearSelection();
lst.Selected = true;
}
}

foreach (ListItem lst in drpElectionYear.Items)
{
if (original.ElectionYearId == Convert.ToInt16(lst.Value))
{
drpElectionYear.ClearSelection();
lst.Selected = true;
}
}
}

Linq Sumbit

protected void btnSubmit_Click(object sender, EventArgs e)
{
try
{
DataClassesDataContext dataContextAdd = new DataClassesDataContext(ConfigurationManager.ConnectionStrings["ConnRootDataBase"].ConnectionString);

MemberYear memberYear = new MemberYear
{
MemberYearId = GenerateID(),
ProfileId = Convert.ToInt64(drpMember.SelectedValue),
GeographicId = Convert.ToInt64(drpConstituency.SelectedValue),
ElectionYearId = Convert.ToInt64(drpElectionYear.SelectedValue)

};
dataContextAdd.MemberYears.InsertOnSubmit(memberYear);
dataContextAdd.SubmitChanges();
dataContextAdd.Dispose();
lblError.Text = "your Information Inserted Succesfully!!";
lblError.ForeColor = System.Drawing.Color.Green;
}
catch (Exception ex)
{
lblError.Text = ex.Message.ToString();
}


}

Linq Bind grid

private void BindGrid()
{
var memberYearDetail = (from MY in Common.dataContext.MemberYears
join PM in Common.dataContext.ProfileMasters
on MY.ProfileId equals PM.ProfileId

join AD in Common.dataContext.AddressDetails
on PM.ProfileId equals AD.LinkedSourceId

join GM in Common.dataContext.GeographyMasters
on AD.GeographicId equals GM.GeographicId
select new
{
MY.ProfileId,
GM.GeographicName,
MemberName = PM.FirstName + " " + PM.MiddleName + " " + PM.LastName
}).Distinct();

grdMemberYear.DataSource = memberYearDetail;
grdMemberYear.DataBind();
}