try
{
SqlConnection con = new SqlConnection(strcon);
con.Open();
SqlCommand cmd = new SqlCommand("select * from main_menu", con);
SqlDataAdapter ad = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
ad.Fill(dt);
if (dt.Rows.Count > 0)
{
foreach (DataRow dr in dt.Rows)
{
content += "<li><a href='" + dr["menu_url"] + "?pid=" + dr["id"] + "'" + ">" + dr["menu_name"] + "</a></li>";
}
nav.InnerHtml = content;
}
con.Close();
}
catch (Exception ex)
{
Response.Write(ex.Message);
}
This is the series of blog posts that will cover the topics discussed in the ASP.NET, C#, MVC, JQUERY and other .Net Programing Language.
Wednesday, 26 November 2014
Asphelp: How To Show multiple Image in ul & li using database
Asphelp: How To Create Dynamic Div Using Sql Server As Database
for (int i = 0; i < dt.Rows.Count; i++)
{
int pro_id = Convert.ToInt32(dt.Rows[i]["pro_id"].ToString());
pro_name = dt.Rows[i]["pro_name"].ToString();
pro_amount = dt.Rows[i]["pro_amount"].ToString();
pro_image = dt.Rows[i]["pro_image"].ToString();
string inputString = "Images/product/" + pro_image;
HtmlGenericControl li = new HtmlGenericControl();
li.TagName = "li";
li.InnerHtml = "<a href=" + "view_detail.aspx?pid=" + pro_id + ">" + "<img src='" + inputString + "' width='" + "180" + "' height='" + "170" + "' runat='" + "Server" + "'s/>" + "</a><br />" + pro_name + "<br /> Rs. " + pro_amount + " PER KG";
dynlatest.Controls.Add(li);
}
Subscribe to:
Posts (Atom)