After clicking the button each time, determine whether the page already has a row. If no repeater row is displayed, and assign it a value. If no repeater row exists, click repeater.
Protected void btnAdd_click (object sender, EventArgs e)
{
Try
{
// Record the number of appends
PressCount ++;
TypeString. Add (typeSelect. SelectedItem. ToString ());
If (typeString. Count> 1)
{
For (int I = 0; I <typeString. Count-1; I ++)
{
If (typeString [typeString. Count-1]. Equals (typeString [I])
{
String lastString = typeString [typeString. Count-1];
TypeString. Remove (lastString );
PressCount --;
Return;
}
}
}
M_con = DataAccess. DbConn ();
If (Session ["sellerSave"]. ToString (). Trim (). Equals ("1 "))
{
// Select a type
If (typeSelect. SelectedValue. ToString (). Equals ("0 "))
{
// The system prompts you to select a type.
ErrorHelp. alertMessageInAjax (Page, "S0100002 ");
}
Else
{
DataTable tab_InfoResInfo = new DataTable ();
Tab_InfoResInfo.Columns.Add ("type", typeof (string ));
Tab_InfoResInfo.Columns.Add ("responsibleCD", typeof (string ));
Tab_InfoResInfo.Columns.Add ("update_username", typeof (string ));
Tab_InfoResInfo.Columns.Add ("update_date", typeof (string ));
Tab_InfoResInfo.Columns.Add ("zipCode", typeof (string ));
Tab_InfoResInfo.Columns.Add ("prefectures", typeof (string ));
Tab_InfoResInfo.Columns.Add ("city", typeof (string ));
Tab_InfoResInfo.Columns.Add ("detail1", typeof (string ));
Tab_InfoResInfo.Columns.Add ("detail2", typeof (string ));
Tab_InfoResInfo.Columns.Add ("email", typeof (string ));
Tab_InfoResInfo.Columns.Add ("department", typeof (string ));
Tab_InfoResInfo.Columns.Add ("title", typeof (string ));
Tab_InfoResInfo.Columns.Add ("name", typeof (string ));
Tab_InfoResInfo.Columns.Add ("tel", typeof (string ));
Tab_InfoResInfo.Columns.Add ("mobile", typeof (string ));
Tab_InfoResInfo.Columns.Add ("fax", typeof (string ));
Tab_InfoResInfo.Columns.Add ("note", typeof (string ));
For (int I = 0; I <pressCount; I ++)
{
// Add rows
DataRow dr = tab_InfoResInfo.NewRow ();
Tab_InfoResInfo.Rows.Add (dr );
}
// Deduplication
Distinct (typeString );
// Convert list to data
String [] typeArray = typeString. ToArray ();
For (int I = 0; I <typeArray. Length; I ++)
{
Tab_InfoResInfo.Rows [I] [0] = typeArray [I];
}
// Tab_InfoResInfo.Rows [pressCount-1] [0] = Session ["repeater_type_string"]. ToString (). Trim ();
SellersIndex_Repeater.DataSource = tab_InfoResInfo;
SellersIndex_Repeater.DataBind ();
For (int I = 0; I <this. sellersIndex_Repeater.Items.Count; I ++)
{
RepeaterItem resItem = sellersIndex_Repeater.Items [I];
TextBox repeater_responsibleCDTextBox = (TextBox) resItem. FindControl ("repeater_responsibleCD ");
Repeater_responsibleCDTextBox.ReadOnly = true;
Repeater_responsibleCDTextBox.Enabled = false;
}
// ResSave. Style. Add ("display", "block ");
// ResSave. Style. Add ("display", "block ");
}
}
Else
{
// Save the parameter values first.
ErrorHelp. alertMessageInAjax (Page, "S0100038 ");
}
}
Catch (MySqlException ex)
{
Lbl_error.Text = ex. ToString ();
LogControl. CmnOutPutLOG (Const. PageCodes. ProCategoryManage, Const. ErrorLevel. ERROR, ex. ToString ());
}
Catch (Exception ex)
{
Lbl_error.Text = ex. ToString ();
LogControl. CmnOutPutLOG (Const. PageCodes. ProCategoryManage, Const. ErrorLevel. ERROR, ex. ToString ());
}
Finally
{
DataAccess. DbClose (m_con );
}
}