Siverlight DataGrid With Checkbox Column

Posted by Kranthi under Silverlight on 4/14/2011 | Points: 10 | Views : 4308 | Status : [Member] | Replies : 5
In My SilverlightDataGrid I have Checkbox Column When Employee Select The CheckBox & His Leave Status Should Be Equal To Pending Then Click the Cancel Buttton Their LeaveStatus Should Stored as Cancelled and The LeaveStatus Mail Should Be Send To the Employee's Company id.




Responses

Posted by: Umeshdwivedi on: 4/14/2011 [Member] Starter | Points: 25

Up
0
Down
Hallo
i understand your query,i find one simler blog pls visit and do better
http://blogs.microsoft.co.il/blogs/davids/archive/2009/04/18/aggregate-checkbox-for-datagridcheckboxcolumn-part-3.aspx

Latest Technology Trainer
And Part time software consultant

Kranthi, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vuyiswamb on: 4/15/2011 [Member] [MVP] [Administrator] NotApplicable | Points: 25

Up
0
Down
Please provide the code you have some that we can correct it

Thank you for posting at Dotnetfunda
[Administrator]

Kranthi, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Kranthi on: 4/18/2011 [Member] Starter | Points: 25

Up
0
Down
When i Check The CheckBox and Click the Cancel Button The Checked Data

Should Be Updated (i.e.,I Have LeaveStatus DataField In That Already Status

As Stored As "P" When i Click The Cancel Button THe Status Will Be

Updated as "C")

Table Name=LEAVEAPP;
Query=GetCancelLeaveApply;
DatGridName=dgCancellation;
ButtonName=btnCancel;

Am using this in Cancelbuttonclick event
private void btnCancel_Click(object sender, RoutedEventArgs e)
{
int empid = Int32.Parse(WebContext.Current.User.Name);
EntityQuery<LEAVEAPP> query =

objectcontext.GetCancelLeaveApplyQuery();
LoadOperation<TMS_ESS_TTB_LEAVEAPP> loadop =

objectcontext.Load(query);


objectcontext.Load(objectcontext.GetCancelLeaveApplyQuery()).Completed

+= new EventHandler(Cancellation_Completed);

objectcontext.SubmitChanges();

}

void Cancellation_Completed(object sender, EventArgs e)
{
CheckBox chkbox =

(CheckBox)this.dgCancellation.Columns[0].GetCellContent(this.dgCancellatio

n.SelectedItem);

List<TMS_ESS_TTB_LEAVEAPP> tblist;
tblist =

((System.ServiceModel.DomainServices.Client.LoadOperation<Spider.Web.T

MS_ESS_TTB_LEAVEAPP>)(sender)).Entities.ToList();
foreach (TMS_ESS_TTB_LEAVEAPP lvapp in tblist)
{
if (lvapp.LV_EMPLOYEEID ==

Int32.Parse(WebContext.Current.User.Name))
objleaveapp = lvapp;
}

if (objleaveapp != null)
{

if ((bool)chkbox.IsChecked)
{
objleaveapp.LV_STATUS = "C ";

}
objectcontext.SubmitChanges();
MessageBox.Show("Done");

}
}

LinqQuery is

public IQueryable<TMS_ESS_TTB_LEAVEAPP> GetCancelLeaveApply()
{
var qry = from tblleaveapp in

this.ObjectContext.TMS_ESS_TTB_LEAVEAPP select tblleaveapp;
return qry;
}

Kranthi, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vuyiswamb on: 4/18/2011 [Member] [MVP] [Administrator] NotApplicable | Points: 25

Up
0
Down
Please format your code in [code] tags, its difficult to read your code

Thank you for posting at Dotnetfunda
[Administrator]

Kranthi, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Kranthi on: 4/18/2011 [Member] Starter | Points: 25

Up
0
Down
When i Check The CheckBox and Click the Cancel Button The Checked Data

Should Be Updated (i.e.,I Have LeaveStatus DataField In That Already Status

As Stored As "P" When i Click The Cancel Button THe Status Will Be

Updated as "C")

Table Name=LEAVEAPP;
Query=GetCancelLeaveApply;
DatGridName=dgCancellation;
ButtonName=btnCancel;

Am using this in Cancelbuttonclick event
private void btnCancel_Click(object sender, RoutedEventArgs e)

{
int empid = Int32.Parse(WebContext.Current.User.Name);
EntityQuery<LEAVEAPP> query =

objectcontext.GetCancelLeaveApplyQuery();
LoadOperation<LEAVEAPP> loadop = objectcontext.Load(query);


objectcontext.Load(objectcontext.GetCancelLeaveApplyQuery()).Completed

+= new EventHandler(Cancellation_Completed);

objectcontext.SubmitChanges();

}

void Cancellation_Completed(object sender, EventArgs e)

{
CheckBox chkbox =

(CheckBox)this.dgCancellation.Columns[0].GetCellContent(this.dgCancellatio

n.SelectedItem);

List<LEAVEAPP> tblist;
tblist =

((System.ServiceModel.DomainServices.Client.LoadOperation<Spider.Web.LE

AVEAPP>)(sender)).Entities.ToList();
foreach (LEAVEAPP lvapp in tblist)
{
if (lvapp.EMPLOYEEID ==

Int32.Parse(WebContext.Current.User.Name))
objleaveapp = lvapp;
}

if (objleaveapp != null)
{

if ((bool)chkbox.IsChecked)
{
objleaveapp.LV_STATUS = "C ";

}
objectcontext.SubmitChanges();
MessageBox.Show("Done");

}
}

LinqQuery is

 public IQueryable<LEAVEAPP> GetCancelLeaveApply()

{
var qry = from tblleaveapp in this.ObjectContext.LEAVEAPP select

tblleaveapp;
return qry;
}


Kranthi, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response