Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4 > BOOK: ASP.NET 4 Website Programming Problem Design Solution
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 4 Website Programming Problem Design Solution section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old April 3rd, 2012, 02:22 AM
Registered User
Join Date: Apr 2011
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Angry Display image in gridview according to selected date of user

<asp:ScriptManager ID="ScriptManager1" runat="server">
<asp:TextBox ID="TextBox1" runat="server" AutoPostBack="True"></asp:TextBox>

<asp:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="TextBox1">


using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Data.OleDb;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Globalization;
public partial class View : System.Web.UI.Page
string strcon = ConfigurationManager.ConnectionStrings["con"].ToString();

protected void Page_Load(object sender, EventArgs e)
string str = TextBox1.Text;

CultureInfo[] cultures = { CultureInfo.CreateSpecificCulture("en-US") };
foreach (CultureInfo culture in cultures)
DateTime date;
date = DateTime.Parse(str, culture);
//string str = TextBox1.Text;
// DateTime date = DateTime.ParseExact(str, "yyyy/MM/DD", null);
//System.DateTime str_date = DateTime.Parse(TextBox1.Text, System.Globalization.CultureInfo.CreateSpecificCul ture("en-AU").DateTimeFormat);
//var userdateformat = DateTime.ParseExact(" ' " + TextBox1.Text.ToString() + " ' ", "yyyyMMdd", System.Globalization.CultureInfo.CurrentCulture);


void Load_GridData()
SqlConnection conn = new SqlConnection(strcon);
conn.Open(); // open the connection
SqlDataAdapter Sqa = new SqlDataAdapter("select Image, ImageName from Img where ([Date] = @date) ", conn);
DataSet ds = new DataSet();
Sqa.Fill(ds); // fill the dataset
GridView1.DataSource = ds; // give data to GridView

date is save in yyyy-mm-dd formate in database.
Old April 23rd, 2016, 03:36 AM
Registered User
Join Date: Apr 2016
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Display image in gridview according to selected date of user

Always use css to display images or contents in gird style from your database...
if size of your content displaying page is 900px then you fix size of each content close to 280px then your 3 images will come in single line....

<div style=" width:280px; height:300px; float:left; padding:10px;">
work with while loop and then you will get result

for more get developers community

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to display image using gridview ? Abhishek Kumar ASP.NET 3.5 Basics 1 March 2nd, 2012 12:07 PM
Display Image selected in RadioButton... JimP Javascript 1 February 12th, 2011 12:16 PM
display last user and modified date punky08 Classic ASP Basics 1 June 24th, 2008 02:52 PM
gridview image display Sheraz Khan ASP.NET 2.0 Basics 1 September 2nd, 2007 11:37 PM
Display image in gridview Sheraz Khan ASP.NET 2.0 Professional 0 August 30th, 2007 10:36 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.