I wanted to display 10 recent news from database. I have used LIMIT 10 in sql query to display 10 recent news. I am using bootstrap.
I am getting only 1 news from the database. I know that here I have to use datalist or listview in design. But I don't know how to implement it using Bootstrap.
Default.aspx:
<div class="container">
<h1 class="main-module-title">Recent <span>News</span></h1>
<%-- <asp:datalist runat="server">
<ItemTemplate>--%>
<div class="row-fluid">
<div class="row">
<div class="col-xs-12 col-sm-3 col-md-3">
<a href="#">
<asp:Image runat="server" ID="ImgNews" class="img-responsive img-box img-thumbnail"/>
</a>
</div>
<div class="col-xs-12 col-sm-9 col-md-9">
<h4><asp:Label ID="newsheader" runat="server" Text=""></asp:Label></h4>
<p runat="server" style="text-align:justify" id="newscontent"> </p>
</div>
</div>
<hr/>
</div>
<%-- </ItemTemplate>
</asp:datalist>--%>
</div>
Default.aspx.cs:
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
MySqlConnection conn = null;
string newsitem = null;
if (!(Request.QueryString["newstitle"] == null))
{
Page.Header.Title = Request.QueryString["newstitle"] + " - DubaiExporters ";
}
else
{
Page.Header.Title = "DubaiExporters - Dubai Business News - UAE Exports";
}
try
{
string connStr = ConfigurationManager.ConnectionStrings["mysqldbeConnectionString"].ToString();
string newssql = null;
newssql = "SELECT * FROM news WHERE status = b'1' AND linkstatus = b'1' ORDER BY datepublished DESC LIMIT 10";
conn = new MySqlConnection(connStr);
MySqlCommand cmd = new MySqlCommand(newssql, conn);
conn.Open();
MySqlDataReader r = cmd.ExecuteReader(CommandBehavior.CloseConnection);
if(r.Read())//while(r.Read())
{
newsheader.Text = HttpUtility.HtmlDecode(r["newstitle"].ToString().Trim()).ToString();
newscontent.InnerHtml = HttpUtility.HtmlDecode(r["newsbrief"].ToString().Trim()).ToString();
ImgNews.ImageUrl = "~/images/newspictures/" + r["image"].ToString();
}
}
catch (MySqlException ex)
{
}
catch (Exception ex)
{
}
finally
{
if (conn != null)
{
conn.Close();
}
}
}
}
try the below template and bind the DataList to DataSource in the Page Load event inside !Page.IsPOstBack condition
<asp:DataList ID="DataList1" runat="server">
<ItemTemplate>
<div class="row-fluid">
<div class="row">
<div class="col-xs-12 col-sm-3 col-md-3">
<a href="#">
<asp:Image runat="server" ID="ImgNews" class="img-responsive img-box img-thumbnail" ImageUrl='<%# "~/images/newspictures/" + Eval("image")%>' />
</a>
</div>
<div class="col-xs-12 col-sm-9 col-md-9">
<h4><a href="#">
<asp:Label ID="newsheader" runat="server" Text='<%# Eval("newstitle") %>'></asp:Label></a></h4>
<p runat="server" style="text-align: justify" id="newscontent"><%# Eval("newsbrief") %></p>
</div>
</div>
<hr />
</div>
</ItemTemplate>
</asp:DataList>
Related
I'm using a bootstrap modal to save and update some sort of events. My asp code is:
<asp:UpdatePanel ID="upModal" runat="server" ChildrenAsTriggers="true" UpdateMode="Conditional">
<ContentTemplate>
<div class="modal fade bs-example-modal-lg" tabindex="-1" role="dialog" id="myModal" aria-labelledby="myLargeModalLabel">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="gridSystemModalLabel">Add event:</h4>
</div>
<div class="modal-body">
<div class="container-fluid">
<div class="row">
<div class="col-md-3">
<div class="row">
<div class="col-md-12">
<h4>Date:</h4>
</div>
<div class="col-md-12">
<asp:TextBox ID="TextBoxDate" runat="server" Width="100" CssClass="rbl"></asp:TextBox>
<asp:ImageButton ID="ImageButton2" ImageUrl="~/calendar.png" CssClass="rbl" runat="server" Height="20" Width="20" />
<ajaxToolkit:CalendarExtender ID="CalendarExtender2" TargetControlID="TextBoxDate" runat="server" PopupButtonID="ImageButton2" Format="dd/MM/yyyy" />
</div>
</div>
</div>
<div class="col-md-3">
<div class="row">
<div class="col-md-12">
<h4>List</h4>
</div>
<div class="col-md-12">
<asp:ListBox ID="ListBoxEgk" runat="server"></asp:ListBox>
</div>
</div>
</div>
<div class="col-md-3">
<div class="row">
<div class="col-md-12">
<h4>info from:</h4>
</div>
<div class="col-md-12">
<asp:TextBox ID="name" runat="server"></asp:TextBox>
</div>
<div class="col-md-12">
<h4>to:</h4>
</div>
<div class="col-md-12">
<asp:ListBox ID="ListBoxEpik" runat="server"></asp:ListBox>
</div>
</div>
</div>
<div class="col-md-3">
<div class="row">
<div class="col-md-12">
<h4>Kind of event:</h4>
</div>
<div class="col-md-12">
<asp:ListBox ID="ListBoxEidosSum" runat="server"></asp:ListBox>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-5">
<div class="col-md-12">
<h4>Event desc:</h4>
</div>
<div class="col-md-12">
<asp:TextBox ID="TextBoxSumvan" runat="server" Height="210px" MaxLength="500" Rows="12" Width="380px" TextMode="MultiLine"></asp:TextBox>
</div>
</div>
<div class="col-md-5">
<div class="col-md-12">
<h4>Actions:</h4>
</div>
<div class="col-md-12">
<asp:TextBox ID="TextBoxE" runat="server" Height="210px" MaxLength="500" Rows="12" Width="380px" TextMode="MultiLine"></asp:TextBox>
</div>
</div>
<div class="col-md-2">
<div class="col-md-12">
<h4>Given to:</h4>
</div>
<div class="col-md-12">
<asp:ListBox ID="ListBoxUsers" runat="server"></asp:ListBox>
</div>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<asp:Button ID="cancelBtn" CssClass="btn btn-default" runat="server" data-dismiss="modal" Text="Ακύρωση" OnClick="cancelBtn_Click" />
<asp:Button ID="saveBtn" runat="server" Text="Αποθήκευση" CssClass="btn btn-primary" OnClick="Btn_save_Click" />
</div>
</div>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
I'm "calling" this modal by:
img ID="addEvent" src="/very-basic-plus-icon.png" data-toggle="modal" data-target=".bs-example-modal-lg" Height="20" Width="20" />
and it works. The modal is showing up and before I used <asp:Updatepanel> it was working perfect but I want to be able to pick events from a grid and show the this modal, update them if i have to etc. The image button bellow is calling a method from behind
<asp:ImageButton ID="imgEdit" ImageUrl="~/edit.png" runat="server" OnClick="imgEdit_Click" />
and what's running from behind is:
static Boolean indexY = false;
static newEvent event4Update = new newEvent();
protected void imgEdit_Click(object sender, ImageClickEventArgs e)
{
GridViewRow gvRow = (GridViewRow)(sender as Control).Parent.Parent;
int index = gvRow.RowIndex;
var item = searchEvents.ElementAt(index);
CMMS_IServiceClient client = new CMMS_IServiceClient();
event4Update = client.returnRowForUpdate(item.RowId);
client.Close();
TextBoxDate.Text = Convert.ToString(event4Update.ImerominiaSumvantos);
name.Text = event4Update.Name;
ListBoxEgk.SelectedValue = event4Update.From;
ListBoxEpik.SelectedValue = event4Update.TroposEpikoinwnias;
UserListBox.SelectedValue = event4Update.AssignmentTo;
TextBoxSumvan.Text = event4Update.Sumvan;
ListBoxEidosSum.SelectedValue = event4Update.TypeOfEvent;
TextBoxEnergeies.Text = event4Update.Actions;
ListBoxUsers.SelectedValue = event4Update.To;
indexY = true;
ScriptManager.RegisterStartupScript(Page, Page.GetType(), "myModal", "$('#myModal').modal();", true);
upModal.Update();
}
Atm my modal is working perfect. Everything is loaded and I can edit but when I press save which is inside my modal there are problems.
protected void Btn_save_Click(object sender, EventArgs e)
{
CMMS_IServiceClient client = new CMMS_IServiceClient();
if (ListBoxEgk.SelectedValue.ToString() == "" ||
ListBoxEpik.SelectedValue.ToString() == "" ||
TextBoxSumvan.Text == "" ||
ListBoxEidosSum.SelectedValue.ToString() == "")
{
Page.ClientScript.RegisterStartupScript(GetType(), "Scripts", "<script>alert('Some field is empty.');</script>");
}
else
{
if (indexY == true)
{
IFormatProvider culture = new System.Globalization.CultureInfo("fr-FR", true);
newEvent updateEvent = new newEvent();
updateEvent.RowId = event4Update.RowId;
updateEvent.ImerominiaSumvantos = DateTime.Parse(TextBoxDate.Text, culture, System.Globalization.DateTimeStyles.AssumeLocal);
updateEvent.Name = name.Text;
updateEvent.From = ListBoxEgk.SelectedValue.ToString();
updateEvent.TroposEpikoinwnias = ListBoxEpik.SelectedValue.ToString();
updateEvent.To = UserListBox.SelectedValue.ToString();
updateEvent.Sumvan = TextBoxSumvan.Text;
updateEvent.TypeOfEvent = ListBoxEidosSum.SelectedValue.ToString();
updateEvent.Actions = TextBoxEnergeies.Text;
updateEvent.AssignmentTo = ListBoxUsers.SelectedValue.ToString();
updateEvent.EventState = (TextBoxEnergeies.Text != "") ? true : false;
client.updateRow(updateEvent);
indexY = false;
event4Update = null;
}
else
{
IFormatProvider culture = new System.Globalization.CultureInfo("fr-FR", true);
newEvent addEvent = new newEvent();
addEvent.ImerominiaSumvantos = DateTime.Parse(TextBoxDate.Text, culture, System.Globalization.DateTimeStyles.AssumeLocal);
addEvent.Name = name.Text;
addEvent.From = ListBoxEgk.SelectedValue.ToString();
addEvent.TroposEpikoinwnias = ListBoxEpik.SelectedValue.ToString();
addEvent.To = UserListBox.SelectedValue.ToString();
addEvent.Sumvan = TextBoxSumvan.Text;
addEvent.TypeOfEvent = ListBoxEidosSum.SelectedValue.ToString();
addEvent.Actions = TextBoxEnergeies.Text;
addEvent.AssignmentTo = ListBoxUsers.SelectedValue.ToString();
addEvent.EventState = (TextBoxEnergeies.Text != "") ? true : false;
client.write(addEvent);
}
client.Close();
ListBoxEgk.ClearSelection();
ListBoxEidosSum.ClearSelection();
ListBoxEpik.ClearSelection();
name.Text = "";
TextBoxEnergeies.Text = "";
TextBoxSumvan.Text = "";
TextBoxDate.Text = "";
ListBoxUsers.ClearSelection();
searchBtn_Click(sender, e);
//ScriptManager.RegisterStartupScript(Page, Page.GetType(), "myModal", "$('#myModal').modal();", true);
//upModal.Update();
}
}
The code is also a huge mess, if anyone can suggest better ways to work with the monster i made please let me know.
Your save button has nothing to dismiss the modal. And I suspect your cancel button's data-dismiss attribute may be interering with the postback mechanism.
Try this:
<asp:Button ID="cancelBtn" CssClass="btn btn-default" runat="server" Text="Ακύρωση" OnClientClick="dismissModal();" OnClick="cancelBtn_Click" />
<asp:Button ID="saveBtn" runat="server" Text="Αποθήκευση" CssClass="btn btn-primary" OnClick="Btn_save_Click" OnClientClick="dismissModal();" />
function dismissModal() {
$('#myModal').modal('hide');
}
The OnClientClick client side method will run, then a postback will occur and your OnClick server side functions will run.
I need to show products details in a page.
My aspx is like below...
<div class="col-xs-12 col-sm-4 no-margin product-item-holder hover"> <!-- this div will be repeated for each product -->
<div class="product-item">
<div class="image">
<img runat="server" id="img" alt="" src="" />
</div>
<div class="body">
<div class="label-discount clear"></div>
<div class="title">
<a runat="server" id="name" href="single-product.html"></a>
</div>
</div>
<div class="prices">
<div class="price-prev"></div>
<div runat="server" id="price" class="price-current pull-right"></div>
</div>
<div class="hover-area">
<div class="add-cart-button">
Enquiry
</div>
</div>
</div>
and my codebehind is like below...
dbConnection cn = new dbConnection();
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
getLoopData();
}
}
public void getLoopData()
{
cn.con.Open();
cn.cmd.Connection = cn.con;
cn.cmd.CommandText = "select * FROM products";
MySqlDataReader reader = cn.cmd.ExecuteReader();
while (reader.Read())
{
//int id = reader.GetInt32(0);
name.InnerText = reader["InventionName"].ToString();
price.InnerText = reader["Price"].ToString();
img.Src = reader["Picture"].ToString();
}
reader.Close();
cn.con.Close();
}
But it is showing only last product details.
How should I repeat the div for each product and how to show every products in page ??
You can use Asp Repeater to do that.
Check this link out : http://www.w3schools.com/aspnet/aspnet_repeater.asp
You need a datagrid control, repeater or similar to show tabular data.
Right now you only have one control per attribute to show all records, that's why last one wins.
Your view/page could be like this:
<asp:Repeater ID="ProductRepeater" runat="server" EnableViewState="False">
<ItemTemplate>
<div class="product-item">
<div class="image">
<img id="img" alt="" src='<%# Eval("Picture") %>' />
///...
</ItemTemplate>
</asp:Repeater>
In your code you could do this:
cn.con.Open();
cn.cmd.Connection = cn.con;
cn.cmd.CommandText = "SELECT InventionName, Price, Picture FROM products";
MySqlDataReader reader = cn.cmd.ExecuteReader();
ProductRepeater.DataSource = reader;
ProductRepeater.DataBind();
You are iterating a list, and assigning data to name, price and img.Src, but you overwrite the values on each iteration, therefore you only have the values from the last element.
You should bind you data source (reader) to an <asp:Repeater>'s DataSource property. In your markup you specify a header (HeaderTemplate), a footer (FooterTemplate) and content (ItemTemplate). You can omit the header and footer template if you don't need them. You can also use an AlternatingItemTemplate if you need to do different things with odd/even rows (e.g. alternating row color in a table).
You can access properties of the databound datatype using the <%# Eval("SomeProperty") %> which is a databinding expression.
HTML markup would be something like this:
<asp:Repeater id="Products" runat="server">
<HeaderTemplate>
</HeaderTemplate>
<ItemTemplate>
<div class="col-xs-12 col-sm-4 no-margin product-item-holder hover"> <!-- this div will be repeated for each product -->
<div class="product-item">
<div class="image">
<img class="img" alt="" src="<%# Eval("Picture") %>" />
</div>
<div class="body">
<div class="label-discount clear"></div>
<div class="title">
<a class="name" href="single-product.html"><%# Eval("InventionName") %></a>
</div>
</div>
<div class="prices">
<div class="price-prev"></div>
<div class="price" class="price-current pull-right"><%# Eval("Price") %></div>
</div>
<div class="hover-area">
<div class="add-cart-button">
Enquiry
</div>
</div>
</div>
</div>
</ItemTemplate>
<FooterTemplate>
</FooterTemplate>
</asp:Repeater>
and wire up the datasource in codebehind like this:
cn.con.Open();
cn.cmd.Connection = cn.con;
cn.cmd.CommandText = "select * FROM products";
MySqlDataReader reader = cn.cmd.ExecuteReader();
Products.DataSource = reader; // rather than iterating manually, you assign the datasource to the repeater.
Products.DataBind();
reader.Close();
cn.con.Close();
Side note: I changed the attribute from id to class on the name, price and img element. Because when this markup is rendered it would have been with multiple elements with the same id, which it shouldn't since id is supposed to be unique according to specification.
I have to use multiple bootstrap carousel in single page, using the asp repeater control but it doesn't work, it just show one slider on the page
Here is the html and asp code
<div class="col-md-12">
<div id="Carousel" class="carousel slide">
<!-- Carousel items -->
<div class="carousel-inner">
<div class="item">
<div class="row">
<asp:Repeater runat="server" ID="Slider1">
<ItemTemplate>
<div class="col-md-2">
<div class="row">
<a target="_blank" href="<%# Eval("URL") %>">
<img class="caption" src="../Includes/gaceta/<%# Eval("Titulo") %>/files/res/pages/page_0000.jpg" alt="<%# Eval("Titulo") %>" width="188" height="222" /></a>
</div>
</div>
</ItemTemplate>
</asp:Repeater>
</div>
<!--.row-->
</div>
</div>
<!--.carousel-inner-->
<a data-slide="prev" href="#Carousel" class="left carousel-control">‹</a>
<a data-slide="next" href="#Carousel" class="right carousel-control">›</a>
</div>
<!--.Carousel-->
</div>
<hr />
<div class="col-md-12">
<div id="Carousel2" class="carousel slide">
<!-- Carousel items -->
<div class="carousel-inner">
<div class="item">
<div class="row">
<asp:Repeater runat="server" ID="Slider2">
<ItemTemplate>
<div class="col-md-2">
<div class="row">
<a target="_blank" href="<%# Eval("URL") %>">
<img class="caption" src="../Includes/gaceta/<%# Eval("Titulo") %>/files/res/pages/page_0000.jpg" alt="<%# Eval("Titulo") %>" width="188" height="222" /></a>
</div>
</div>
</ItemTemplate>
</asp:Repeater>
</div>
<!--.row-->
</div>
</div>
<!--.carousel-inner-->
<a data-slide="prev" href="#Folletos" class="left carousel-control">‹</a>
<a data-slide="next" href="#Folletos" class="right carousel-control">›</a>
</div>
<!--.Carousel-->
the javascript
$(document).ready(function () {
$('#Carousel').carousel('pause');
$('#Carousel2').carousel('pause');
$("div.item:first").addClass("active");
});
and the methods to bind the repeater
protected void Page_Load(object sender, EventArgs e)
{
BindSlider1(5);
BindSlider2(1);
}
protected void BindSlider1(int Ubicacion)
{
using (SqlConnection con = Conexion.Conecta())
{
using (SqlCommand cmd = new SqlCommand("SelGacetaUbicacion", con))
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("#UBICACION", SqlDbType.Int).Value = Ubicacion;
con.Open();
Slider1.DataSource = cmd.ExecuteReader();
Slider1.DataBind();
}
}
}
protected void BindSlider2(int Ubicacion)
{
using (SqlConnection con = Conexion.Conecta())
{
using (SqlCommand cmd = new SqlCommand("SelGacetaUbicacion", con))
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("#UBICACION", SqlDbType.Int).Value = Ubicacion;
con.Open();
Slider2.DataSource = cmd.ExecuteReader();
Slider2.DataBind();
}
}
}
I tried your code, and found this issues:
1- Review how to build the carousel markup depending on which version of bootstrap you are using. I tried with Bootstrap v3.1.0 and had to change parts of your markup. Refer to documentation or this sample.
For instance, <div class="item"> should be placed inside your repeater, and should have a <div class="container"> immediatly inside of it.
2- You are not initializing correctly both carousels from jquery, do something like this to correct it:
$("#Carousel div.item:first").addClass("active");
$("#Carousel2 div.item:first").addClass("active");
I'm using ASP.NET Repeater for dynamically generating HTML code and pagination. I use totally same code on two aspx pages and on one all works fine, but on the other one I get an Exception: Object reference not set to an instance of an object.
Now I understand why the exception occurred, it simply has a null value, repeater didn't render I guess. But does anyone know why this error happened and how it's possible that it works on one page, and doesn't work on the other? Where should I look for "real" problem?
This is my HTML code on the aspx page:
<div class="accordion-wrap projects">
<asp:Repeater runat="server" ID="projectRepeter">
<ItemTemplate>
<div class="item">
<div class="heading">
<span>
<asp:Label runat="server" ID="TeamMemberName" Text='<%#Eval("ProjectName")%>'></asp:Label></span><span><em>x</em></span>
<i>+</i>
</div>
<div class="details">
<ul class="form">
<li>
<label>Project name:</label>
<input type="text" class="in-text" value="<%#Eval("ProjectName")%>" />
</li>
<li>
<label>Lead:</label>
<asp:DropDownList runat="server" DataSourceID="TeamMemberNameDS"></asp:DropDownList>
</li>
</ul>
<ul class="form">
<li>
<label>Description:</label>
<input type="text" class="in-text" value="<%#Eval("Description")%>" />
</li>
</ul>
<ul class="form last">
<li>
<label>Customer:</label>
<asp:DropDownList runat="server" DataSourceID="ClientNameDS"></asp:DropDownList>
</li>
<li class="inline">
<label>Status:</label>
<span class="radio">
<label for="inactive">Active:</label>
<input type="radio" value="1" name="status" id="inactive" />
</span>
<span class="radio">
<label for="active">Inactive:</label>
<input type="radio" value="2" name="status" id="active" />
</span>
<span class="radio">
<label for="active">Archive:</label>
<input type="radio" value="3" name="status" id="Radio1" />
</span>
</li>
</ul>
<div class="buttons">
<div class="inner">
Save
Delete
</div>
</div>
</div>
</div>
</ItemTemplate>
</asp:Repeater>
</div>
<div class="pagination">
<asp:Repeater ID="rptPagingProject" runat="server" OnItemCommand="rptPaging_ItemCommand">
<ItemTemplate>
<asp:LinkButton ID="btnPage"
CommandName="Page" CommandArgument="<%# Container.DataItem %>" runat="server" ForeColor="Black" Font-Bold="True"><%# Container.DataItem %>
</asp:LinkButton>
</ItemTemplate>
</asp:Repeater>
</div>
And this is the code behind:
protected void BindRepeater()
{
string ConnectionString = "Data Source=PRACTICE-001;Initial Catalog=n.mosorinski;User ID=n.mosorinski;Password=n.mosorinski;MultipleActiveResultSets=True;Application Name=EntityFramework";
SqlConnection con = new SqlConnection(ConnectionString);
SqlCommand cmd = new SqlCommand("SELECT p.ProjectName, p.Description, c.ClientName FROM Project AS p INNER JOIN Client AS c ON p.CustomerID = c.ClientID", con);
if (con.State == ConnectionState.Closed)
{
con.Open();
}
DataTable dt = new DataTable();
SqlDataAdapter adp = new SqlDataAdapter(cmd);
adp.Fill(dt);
PagedDataSource pgitems = new PagedDataSource();
DataView dv = new DataView(dt);
pgitems.DataSource = dv;
pgitems.AllowPaging = true;
pgitems.PageSize = 5;
pgitems.CurrentPageIndex = PageNumber;
if (pgitems.PageCount > 1)
{
rptPagingProject.Visible = true;
ArrayList pages = new ArrayList();
for (int i = 0; i < pgitems.PageCount; i++)
pages.Add((i + 1).ToString());
rptPagingProject.DataSource = pages;
rptPagingProject.DataBind();
}
else
{
rptPagingProject.Visible = false;
}
projectRepeter.DataSource = pgitems;
projectRepeter.DataBind();
}
public int PageNumber
{
get
{
if (ViewState["PageNumber"] != null)
return Convert.ToInt32(ViewState["PageNumber"]);
else
return 0;
}
set
{
ViewState["PageNumber"] = value;
}
}
protected void rptPaging_ItemCommand(object source, RepeaterCommandEventArgs e)
{
PageNumber = Convert.ToInt32(e.CommandArgument) - 1;
BindRepeater();
}
}
I have a repeater control inside a carousel which in turn is inside a modal.The problem is that the id of repeater control is not recogized or as it says id dosent exist in current context.
<div class="modal fade gallarymodal" id="mygallary" style=" width:1300px; height:100%;" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog mdialog">
<div class="modal-content" >
<div class="modal-body mbody">
<div id="myCarousel" class="carousel slide">
<div class="carousel-inner">
<asp:Repeater ID="repid" runat="server">
<ItemTemplate>
<div class="item" >
<div class="item active">
<asp:Image ID="wtf" runat="server" ImageUrl='<%#Eval("imgPath") %>' Width="1000px" Height="490px" />
</div>
</div>
</ItemTemplate>
</asp:Repeater>
</div>
</div>
</div>
</div>
</div>
</div>
And here is my .cs code
public void bindslide()
{
//string str = Session["userid"].ToString();
string str = "22";
sq.connection();
SqlCommand cmd = new SqlCommand("select * from mygallary where regId_img='" + str + "' ", sq.con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
//DataSet ds = new DataSet();
DataTable dt = new DataTable();
da.Fill(dt);
//da.Fill(ds);
if (dt.Rows.Count > 0)
{
repid.DataSource = dt;
repid.DataBind();
sq.con.Dispose();
sq.con.Close();
}
else
{
}
}
I am very much confused why the id repeater control is not recognized.
asp:Repeater ID="wtf"
asp:Image ID="wtf"
maybe the problem both got same id .
try change the id of one of them .
one closing tag on div missing