Prev: 2010 WebDeployment after build don't execute
Next: Config Transforms with Web Deployment Projects
From: JohnE on 25 Jun 2010 18:25 Have the following for inserting a person's name. If the user was to select the empty space of the droplist, it will error. I was wondering if an else or the full try...catch would be needed here? If an else is sufficient, what is the better approach in what to use. protected void lvwDetailDeveloperEditInsert_ItemInserting(object sender, ListViewInsertEventArgs e) { DropDownList ddlDeveloperIDInsertEdit = (DropDownList)e.Item.FindControl("ddlDeveloperIDInsertEdit"); Label ChangeRequestIDLabel = (Label)e.Item.FindControl("ddlSelectChangeRequest"); if (ddlDeveloperIDInsertEdit != null) { e.Values["DeveloperID"] = (Convert.ToInt32(ddlDeveloperIDInsertEdit.SelectedValue)); e.Values["ChangeRequestID"] = (Convert.ToInt32(ddlSelectChangeRequest.SelectedValue)); } } Thanks...John
From: Mr. Arnold on 25 Jun 2010 19:18 JohnE wrote: > Have the following for inserting a person's name. If the user was to select > the empty space of the droplist, it will error. I was wondering if an else > or the full try...catch would be needed here? If an else is sufficient, what > is the better approach in what to use. > > protected void lvwDetailDeveloperEditInsert_ItemInserting(object sender, > ListViewInsertEventArgs e) > { > DropDownList ddlDeveloperIDInsertEdit = > (DropDownList)e.Item.FindControl("ddlDeveloperIDInsertEdit"); > Label ChangeRequestIDLabel = > (Label)e.Item.FindControl("ddlSelectChangeRequest"); > > if (ddlDeveloperIDInsertEdit != null) > { > e.Values["DeveloperID"] = > (Convert.ToInt32(ddlDeveloperIDInsertEdit.SelectedValue)); > e.Values["ChangeRequestID"] = > (Convert.ToInt32(ddlSelectChangeRequest.SelectedValue)); > } > } > > Thanks...John If the value is null or string.empty the just exit. If (object == null) // or it could empty.string I guess return; // exit the method
|
Pages: 1 Prev: 2010 WebDeployment after build don't execute Next: Config Transforms with Web Deployment Projects |