星空网 > 软件开发 > ASP.net

每次点击按钮后,判断页面是否已经有该行,没有弹出repeater的一行,并给他赋一个这行附值,没有则跳出

protected void btnAdd_click(object sender, EventArgs e)
{

try
{

//记录第几次追加
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"))
{
//是否选择種别
if (typeSelect.SelectedValue.ToString().Equals("0"))
{
//提示选择種别
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++)
{

//添加行
DataRow dr = tab_InfoResInfo.NewRow();
tab_InfoResInfo.Rows.Add(dr);
}
//去重
distinct(typeString);
//list转换成数据
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
{
//请先保存販売先情報
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);
}

 

}




原标题:每次点击按钮后,判断页面是否已经有该行,没有弹出repeater的一行,并给他赋一个这行附值,没有则跳出

关键词:Repeater

*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。

复工不顺,富士康奖励复工员工:每人3000元:https://www.ikjzd.com/articles/115986
亚马逊自称“地球上小企业的最大捍卫者”:https://www.ikjzd.com/articles/115987
共享充电宝陷入生死危机:1月工资减半,员工无限期待命:https://www.ikjzd.com/articles/115988
亚马逊五行特性的17点通用法则:https://www.ikjzd.com/articles/115989
高流量标题的写法 提高被亚马逊收录:https://www.ikjzd.com/articles/115990
疫情之下,货代行业将何去何从?:https://www.ikjzd.com/articles/115991
怪物在游轮上复活的电影 怪物在游轮上复活的电影叫什么:https://www.vstour.cn/a/411230.html
在线旅游如何选择更优惠的旅游产品?:https://www.vstour.cn/a/411231.html
相关文章
我的浏览记录
最新相关资讯
海外公司注册 | 跨境电商服务平台 | 深圳旅行社 | 东南亚物流