我有一个按钮来显示有关客户的记录或信息,我刚刚注意到的问题是,当我选择一个提供了所有必要信息的客户时,该特定客户的信息会正确显示,现在当我尝试显示另一个客户时有一些缺失字段的信息,那个时候这个特定客户的缺失字段被以前的客户信息替换,这意味着我需要在显示客户信息之前清除文本框。这是我必须显示的方法信息。
public void ShowCustomerInformationCat1()
{
if (customer.cCustomerType != null)
{
ModifyCustomerByCategoryddlCustomerType.SelectedIndex = ModifyCustomerByCategoryddlCustomerType.Items.IndexOf(ModifyCustomerByCategoryddlCustomerType.Items.FindByText(customer.cCustomerType.Trim()));
ModifyCustomerByCategoryddlNewCustomerType.SelectedIndex = ModifyCustomerByCategoryddlNewCustomerType.Items.IndexOf(ModifyCustomerByCategoryddlNewCustomerType.Items.FindByText(customer.cCustomerType.Trim()));
}
if (customer.cInitial != null)
{
ModifyCustomerByCategoryddlInitial.SelectedIndex = ModifyCustomerByCategoryddlInitial.Items.IndexOf(ModifyCustomerByCategoryddlInitial.Items.FindByText(customer.cInitial.Trim()));
ModifyCustomerByCategoryddlNewInitial.SelectedIndex = ModifyCustomerByCategoryddlNewInitial.Items.IndexOf(ModifyCustomerByCategoryddlNewInitial.Items.FindByText(customer.cInitial.Trim()));
}
if (customer.cGender != null)
{
ModifyCustomerByCategoryddlGender.SelectedIndex = ModifyCustomerByCategoryddlGender.Items.IndexOf(ModifyCustomerByCategoryddlGender.Items.FindByText(customer.cGender.Trim()));
ModifyCustomerByCategoryddlNewGender.SelectedIndex = ModifyCustomerByCategoryddlNewGender.Items.IndexOf(ModifyCustomerByCategoryddlNewGender.Items.FindByText(customer.cGender.Trim()));
}
if (customer.cCountry != null)
{
ModifyCustomerByCategoryddlCountry.SelectedIndex = ModifyCustomerByCategoryddlCountry.Items.IndexOf(ModifyCustomerByCategoryddlCountry.Items.FindByText(customer.cCountry.Trim()));
ModifyCustomerByCategoryddlNewCountry.SelectedIndex = ModifyCustomerByCategoryddlNewCountry.Items.IndexOf(ModifyCustomerByCategoryddlNewCountry.Items.FindByText(customer.cCountry.Trim()));
}
}
任何人都可以建议我如何清除文本框,我不想单独清除它们。感谢您的任何建议。