Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Using the mmDataGrid with a DropDownList TEMPLATECOLUMN
Message
De
29/07/2004 19:50:08
 
 
À
29/07/2004 01:28:42
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Divers
Thread ID:
00929073
Message ID:
00929420
Vues:
7
OK--I got it using the ASP.NET DDL.

I wanted to just take the lazy way and set a property and have it update the info for me, but, alas, I was unable to accomplish this. Instead I added a massive code block (a whole 3 lines) into the DG_UpdateCommand which updates the dataset with the selected value.
private void grdRules_UpdateCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) {
	// Get the item to be updated
	this.grdRules.EditItemIndex = e.Item.ItemIndex;

	// Get the selected DDL value
	string newVal = ((DropDownList)e.Item.FindControl("ddlRuleType")).SelectedValue;
	// Retrieve the previous Order Detail DataSet
	this.__dsSiteRules = (DataSet)Session["dsSiteRules"];
	//Update the DataSet with the selected DDL Value
	this.__dsSiteRules.Tables[0].Rows[e.Item.DataSetIndex]["RuleType"] = newVal;
	// Save the DataSet (the DataGrid automatically binds back)
	this.Save(this.oSiteRules, this.__dsSiteRules);
	// Push the updated DS back into the Session Variable
	Session["dsSiteRules"] = this.__dsSiteRules;
	// Reset the edited item and rebind the DataGrid
	this.grdRules.EditItemIndex = -1;
	this.BindControl(this.grdRules);
}
MAS
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform