| Author: Abhay 31 Oct 2008 | Member Level: Diamond | Rating:   Points: 3 |
private void dgdetail_ItemCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) { if(e.CommandName == "changestatus") { for(int i=0;i<dgdetail.Items.Count ;i++) { CheckBox Checkuser = (CheckBox) dgdetail.Items[i].FindControl("Checkuser"); if(Checkuser.Checked) { HtmlInputHidden hidPkid = (HtmlInputHidden) dgdetail.Items[i].FindControl("hidPkid"); int pkid=Convert.ToInt32(hidPkid.Value.ToString()); string updateuser="update LOGIN set USER_STATUS=1 where PK_USER_ID='"+pkid+"'"; connection ob=new connection(); ob.nonquery(updateuser); RegisterStartupScript("hi","<script>alert('STATUS CHANGED SUCESSFULLY');</script>"); } else { HtmlInputHidden hidPkid = (HtmlInputHidden) dgdetail.Items[i].FindControl("hidPkid"); int pkid=Convert.ToInt32(hidPkid.Value.ToString()); string updateuser="update LOGIN set USER_STATUS=0 where PK_USER_ID='"+pkid+"'"; connection ob=new connection(); ob.nonquery(updateuser); RegisterStartupScript("hi","<script>alert('STATUS CHANGED SUCESSFULLY');</script>");
} } } }
CODE WILL LIKE ABOVE.
here command name is for
<HeaderTemplate> <asp:CheckBox ID="chkall" Runat="server" onclick="if(this.checked){checkall()}else{uncheckall()}"></asp:CheckBox> <asp:Button runat="server" id="btnupdate" Text="CHANGE STATUS" style="WIDTH: 120px; COLOR: #ffffff; HEIGHT: 25px; BACKGROUND-COLOR: #00cccc" CommandName="changestatus"></asp:Button> </HeaderTemplate>
that no required as your requirement is concerned.
Thanks and Regards, Abhay
|
| Author: shekhar 31 Oct 2008 | Member Level: Gold | Rating: Points: -20 |
function DeleteProducts() { ? ?// Flag to indicate whether at least one product has been selected ?var hasSelected = false;
? ?// Get all checkboxes / products ? ?var products = document.getElementsByName( 'deleteproduct' );
? ?// Loop the checkboxes / products to check whether at least one product has been selected ? ?for( var n = 0; n < products.length; n++ ) ? ?{ ? ? ? ?if( products[n].checked ) ? ? ? ? ? ?hasSelected = true; ? ?} ? ? ? ?if( hasSelected ) ? ?{ ? // ...at least one product has been selected... ? ? ? ?if( confirm( "Are you sure you want to delete selected product(s)?" )) ? ? ? ?{ ? // ...ask for user confirmation whether to delete the selected product(s) ? ? ? ? ? ?for( var n = 0; n < products.length; n++ ) ? ? ? ? ? ?{ ? ? ? ? ? ? ? ?if( products[n].checked ) ? ? ? ? ? ? ? ? ? ?alert( products[n].value ); ? ? ? ? ? ?} ? ? ? ?} ? ?} ? ?else ? ?{ ? // ...no product has been selected... ? ? ? ?alert( "Please select at least one product to delete." ); ? ?} }
|
| Author: shekhar 01 Nov 2008 | Member Level: Gold | Rating:  Points: 6 |
private void dgdetail_ItemCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) {
if(e.CommandName == "changestatus") { for(int i=0;i<dgdetail.Items.Count ;i++) { CheckBox Checkuser = (CheckBox) dgdetail.Items[i].FindControl("Checkuser"); if(Checkuser.Checked) { HtmlInputHidden hidPkid = (HtmlInputHidden) dgdetail.Items[i].FindControl("hidPkid"); int pkid=Convert.ToInt32(hidPkid.Value.ToString()); string updateuser="update LOGIN set USER_STATUS=1 where PK_USER_ID='"+pkid+"'"; connection ob=new connection(); ob.nonquery(updateuser); RegisterStartupScript("hi","<script>alert('STATUS CHANGED SUCESSFULLY');</script>"); } else { HtmlInputHidden hidPkid = (HtmlInputHidden) dgdetail.Items[i].FindControl("hidPkid"); int pkid=Convert.ToInt32(hidPkid.Value.ToString()); string updateuser="update LOGIN set USER_STATUS=0 where PK_USER_ID='"+pkid+"'"; connection ob=new connection(); ob.nonquery(updateuser); RegisterStartupScript("hi","<script>alert('STATUS CHANGED SUCESSFULLY');</script>");
} }
}
}
hope fully this will solve your problem thank you
|