PDA

View Full Version : سوال: ارور برای مکان قرارگیری کنترل UpdatePanel



forodo
سه شنبه 15 مهر 1393, 11:47 صبح
سلام
من تگ آغازین کنترل UpdatePanel رو قبل از %> قرار می دم و تگ پایانی UpdatePanel رو بعد از <%
و کدهای داخل <% %> هم ایناست که موقع اجرا ارور می گیره:

<%
try
{
using (System.Data.SqlClient.SqlConnection sqlConn = new System.Data.SqlClient.SqlConnection(ConfigurationM anager.ConnectionStrings[""].ConnectionString))
{
System.Data.SqlClient.SqlDataAdapter da = new System.Data.SqlClient.SqlDataAdapter();
System.Data.DataTable dt = new System.Data.DataTable();
da.SelectCommand = new System.Data.SqlClient.SqlCommand();
if (Request.QueryString["Type"] != null)
{
da.SelectCommand.CommandText = "SELECT *,dbo.fn_Counter(ID) AS CountComment FROM tblTraining WHERE tblTypeOfTrainingID = " + Convert.ToInt32(Request.QueryString["Type"]) + " ORDER BY SendDate DESC, SendTime DESC";
}
else
{
da.SelectCommand.CommandText = "SELECT *,dbo.fn_Counter(ID) AS CountComment FROM tblTraining ORDER BY SendDate DESC, SendTime DESC";
}
da.SelectCommand.Connection = sqlConn;
sqlConn.Open();
da.Fill(dt);
sqlConn.Close();
int dtCount = dt.Rows.Count;
try
{
if (Request.QueryString["Page"] != null)
{
for (int i = (3 * (Convert.ToInt32(Request.QueryString["Page"]))) - 3; i < 3 * (Convert.ToInt32(Request.QueryString["Page"])); i++)
{
Response.Write("<div id=\"Content\"><div><div class=\"Mozu\">" + dt.Rows[i]["Subject"] + "</div><div><ul class=\"MozuInformation\"><li style=\"padding-right:0px;\">تاریخ ایجاد : " + dt.Rows[i]["SendDate"] + "</li><li>بازدید : " + dt.Rows[i]["Visit"] + "</li><li>نظرات : " + dt.Rows[i]["CountComment"] + "</li></ul></div><div class=\"MatneAamuzesh\">" + dt.Rows[i]["SummaryOfTraining"] + "</div><div class=\"EdameyeMatlab\"><a href=\"Show.aspx?IdShow=" + dt.Rows[i]["ID"] + "\">... ادامه مطلب</a></div></div></div>");
Response.Write("<div style=\"background-color:#DDD; height:10px; clear:left;\"><!--خالی--></div>");
}
}
else
{
for (int i = 0; i < 3; i++)
{
Response.Write("<div id=\"Content\"><div><div class=\"Mozu\">" + dt.Rows[i]["Subject"] + "</div><div><ul class=\"MozuInformation\"><li style=\"padding-right:0px;\">تاریخ ایجاد : " + dt.Rows[i]["SendDate"] + "</li><li>بازدید : " + dt.Rows[i]["Visit"] + "</li><li>نظرات : " + dt.Rows[i]["CountComment"] + "</li></ul></div><div class=\"MatneAamuzesh\">" + dt.Rows[i]["SummaryOfTraining"] + "</div><div class=\"EdameyeMatlab\"><a href=\"Show.aspx?IdShow=" + dt.Rows[i]["ID"] + "\">... ادامه مطلب</a></div></div></div>");
Response.Write("<div style=\"background-color:#DDD; height:10px; clear:left;\"><!--خالی--></div>");
}
}
}
catch (Exception)
{

}
}
}
catch
{
Response.Write("Error: Error while downloading file!");
}

%>

forodo
سه شنبه 15 مهر 1393, 12:27 عصر
هرچی که هست رو باید داخل تگ <ContentTemplate> قرار می دادم.
درست شد.