PDA

View Full Version : سوال: مشکل در بایند Repeater



asiehmohammadian
پنج شنبه 09 بهمن 1393, 11:12 صبح
سلام به همه
من یک ریپیتر دارم که در اتصالش به بانک مشکل دارم
کد html اینه :


<div id="dvAccordian" style = "width:400px"> <asp:Repeater ID="rptAccordian" runat="server"> <ItemTemplate> <h3> <%# Eval("title") %></h3> <div> <p> <%# Eval("content") %> </p> </div> </ItemTemplate> </asp:Repeater></div>

ودر قسمت کد بیهاند این ونوشتم :


protected void Page_Load(object sender, EventArgs e)
{
if (!string.IsNullOrWhiteSpace(Request.QueryString["id"]))
{
this.BindRepeater(Convert.ToInt32(Request.QueryStr ing["id"]));
}
}
private void BindRepeater(int id)
{



SqlConnection con=new SqlConnection(@"Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirector y|\Database.mdf;Integrated Security=True;User Instance=True");
using (SqlCommand cmd = new SqlCommand())
{
cmd.CommandText = "select title, content from tblcontent where fkid=@id";
cmd.Parameters.AddWithValue("@id", SqlDbType.Int);
cmd.Parameters["@id"].Value = id;
cmd.Connection = con;
con.Open();
rptAccordian.DataSource = cmd.ExecuteReader();
rptAccordian.DataBind();
con.Close();




}
}

نمیدونم مشکل کد کجاست که هیچی نمایش نمیده
اون fkid کلید خارجی در یک جدول دیگه است
دوستان خواهش میکنم لطف کنید راهنماییم کنید

neda555
پنج شنبه 09 بهمن 1393, 13:03 عصر
از breakpoint استفاده کن ببین id چه مقداریه موقع اجرا

asiehmohammadian
پنج شنبه 09 بهمن 1393, 13:59 عصر
breakpoint که میذارم اصلا عمل نمیکنه
کلا هیچ فرقی نمیکنه با نذاشتن بریک پوینت:افسرده:

asiehmohammadian
پنج شنبه 09 بهمن 1393, 15:02 عصر
دوستان هیچ کس راهی به ذهنش نمیرسه ؟؟؟:افسرده: