How to show pop up menu from database in gridview on each gridview row items ?
Example of this is :
http://www.redbus.in/Booking/SelectBus.aspx?fromCityId=73
You can handle this with javascript/jQuery. The gridview itself has nothing to do with this.
If I was going to build what he has just by looking at it I would create the table dynamically. This way you could use a string builder and insert variable names in between each td tag. You retrieve all your data from the database and store in a List or even better use LINQ to SQL.
I wish I could give you a sample in VB, but here is an example of what I'm talking about.
protected void Page_Load(object sender, EventArgs e)
{
StoreDataContext db = new StoreDataContext();
var join = from b in db.Brands
select new
{
Brand = b,
c = b.Description.Length < 204 ? b.Description : b.Description.Substring(0, 204) + "...",
Sources =
from s in db.Sources
join xref in db.Brands_Sources on s.SourceID equals xref.SourceID
where xref.BrandID == b.BrandID
select s
};
StringBuilder sb = new StringBuilder();
sb.Append( "");
sb.Append( "Active Image Name Short Description Source Date Created Data Modified ");
foreach (var result in join)
{
string chk = (result.Brand.Active ? "checked='checked'" : "");
sb.AppendFormat( "
" +
"{2} {3} ", chk, result.Brand.Image, result.Brand.Name, result.c,result.Brand.BrandID);
sb.Append("");
foreach (var q in result.Sources)
{
string srcname = (q.Source1=="Motovicity" ? "Motovicity":"Direct");
sb.AppendFormat("
", q.Image,srcname);
}
string date = string.Format("{0:MM/dd/yy}", result.Brand.DateCreated);
string mod = string.Format("{0:MM/dd/yy}", result.Brand.DateModified);
sb.Append(" ");
sb.AppendFormat("{0} {1} ", date, mod);
}
sb.Append("
");
resultSpan.InnerHtml = sb.ToString();
}
As you can see I code the html for a checkbox and insert the brand id into the value attribute.