1001>auto loop if display
_int_emp_id_true_count = Convert.ToInt32(strTemp);
if (_int_emp_id_true_count > 0)
{
for (int i = 1; i <= _int_emp_id_true_count; i++)
{
HtmlTableRow tr = (HtmlTableRow)FindControl("employee_0" + i);
tr.Visible = true;
}
}
1002>auto loop set value to *.text
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
strTemp = ds.Tables[0].Rows[i]["emp_id"].ToString();
HtmlInputText itext_01 = (HtmlInputText)FindControl("emp_id_0" + j);
itext_01.Value = proc_get_emp_id_format_sql(strTemp);
HtmlInputText itext_02 = (HtmlInputText)FindControl("amount_0" + j);
itext_02.Value = "40";
j++;
}
1003>>auto loop get value from *.txt
for (int i = 1; i <= _int_emp_id_true_count; i++)
{
DataRow newDR = newDT.NewRow();
semp_id = Utils.Request("emp_id_0" + i); //this.emp_id_01.Value;
_str_temp = semp_id.Substring(semp_id.LastIndexOf("_") + 1, semp_id.Length - semp_id.LastIndexOf("_") - 1);
semp_id = NewSalesOrder.Proc_Get_Emp_Id_Sql(_str_temp);
newDR[0] = str_so_id_guid;
newDR[1] = semp_id;
newDR[2] = Utils.Request("amount_0" + i);
newDT.Rows.Add(newDR);
}
2001>>Utils.cs文件
namespace DCRM.Financial.Web.component
{
public abstract class Utils
{
public static string Request(string val)
{
try
{
return System.Web.HttpContext.Current.Request[val].ToString();
}
catch
{
return string.Empty;
}
}
}
}
1005>>auto loop set value to *.text OR *.cmb
private void proc_load_so_prod_id_sql(DataSet ds)
{
if (ds.Tables[0].Rows.Count > 0)
{
string str_price_00 = string.Empty;
string str_product_type_00 = string.Empty;
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
str_price_00 += "'" + ds.Tables[0].Rows[i]["product_id"].ToString() + "',";
str_product_type_00 += "'" + ds.Tables[0].Rows[i]["product_type"].ToString() + "',";
}
str_price_00 = str_price_00.Substring(0, str_price_00.Length - 1);
str_product_type_00 = str_product_type_00.Substring(0, str_product_type_00.Length - 1);
StringBuilder js_prod_id_set = new StringBuilder();
js_prod_id_set.AppendLine("<script>");
js_prod_id_set.AppendLine("function show_prod_id_set(){");
js_prod_id_set.AppendLine("var str_price_00=[" + str_price_00 + "];");
js_prod_id_set.AppendLine("var str_product_type_00=[" + str_product_type_00 + "];");
js_prod_id_set.AppendLine("for (var i=0;i<" + ds.Tables[0].Rows.Count + ";i++)");
js_prod_id_set.AppendLine(" {");
js_prod_id_set.AppendLine("document.getElementById('prod_idRPT$ctl0' + i + '$price_01').value=str_price_00[i];");
js_prod_id_set.AppendLine("document.getElementById('prod_idRPT$ctl0' + i + '$Uc_product_type_01$UserControlId').value=str_product_type_00[i];");
js_prod_id_set.AppendLine(" }");
js_prod_id_set.AppendLine("}");
js_prod_id_set.AppendLine("show_prod_id_set();");
js_prod_id_set.AppendLine("</script>");
Label lab_prod_id_set = new Label();
lab_prod_id_set.Text = js_prod_id_set.ToString();
Page.Controls.Add(lab_prod_id_set);
}
}
#endregion