Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4 > BOOK: ASP.NET 4 Website Programming Problem Design Solution
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old April 3rd, 2012, 03:22 AM
Registered User
Points: 17, Level: 1
Points: 17, Level: 1 Points: 17, Level: 1 Points: 17, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2011
Location: INDIA
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:ScriptManager>
<div>
<asp:TextBox ID="TextBox1" runat="server" AutoPostBack="True"></asp:TextBox>

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

</div>


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);

Load_GridData();

}
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
GridView1.DataBind();
conn.Close();
}
}


ERROR:- STRING IS NOT RECOGNIZED AS VALID DATETIME.
date is save in yyyy-mm-dd formate in database.
Reply With Quote
  #2 (permalink)  
Old April 23rd, 2016, 04:36 AM
Registered User
Points: 9, Level: 1
Points: 9, Level: 1 Points: 9, Level: 1 Points: 9, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
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;">
<?php
work with while loop and then you will get result
?>
</div>

for more get developers community
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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 03:52 PM
gridview image display Sheraz Khan ASP.NET 2.0 Basics 1 September 3rd, 2007 12:37 AM
Display image in gridview Sheraz Khan ASP.NET 2.0 Professional 0 August 30th, 2007 11:36 PM



All times are GMT -4. The time now is 11:39 PM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.