Click here to Skip to main content
16,017,448 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: is it possible to import a dll file which was developed my vb.net in to a asp.net application? Pin
MS Lee17-Dec-08 17:42
MS Lee17-Dec-08 17:42 
GeneralRe: is it possible to import a dll file which was developed my vb.net in to a asp.net application? Pin
N a v a n e e t h17-Dec-08 17:56
N a v a n e e t h17-Dec-08 17:56 
GeneralRe: is it possible to import a dll file which was developed my vb.net in to a asp.net application? Pin
MS Lee17-Dec-08 18:01
MS Lee17-Dec-08 18:01 
QuestionGridView HeaderText Horizontaly Pin
EBeylo17-Dec-08 3:06
EBeylo17-Dec-08 3:06 
AnswerRe: GridView HeaderText Horizontaly Pin
Abhijit Jana17-Dec-08 3:18
professionalAbhijit Jana17-Dec-08 3:18 
GeneralRe: GridView HeaderText Horizontaly Pin
EBeylo17-Dec-08 3:28
EBeylo17-Dec-08 3:28 
GeneralRe: GridView HeaderText Horizontaly Pin
Abhijit Jana17-Dec-08 3:36
professionalAbhijit Jana17-Dec-08 3:36 
GeneralRe: GridView HeaderText Horizontaly Pin
EBeylo17-Dec-08 3:48
EBeylo17-Dec-08 3:48 
QuestionGridView event handler not working Pin
compninja2517-Dec-08 2:59
compninja2517-Dec-08 2:59 
AnswerRe: GridView event handler not working Pin
Abhijit Jana17-Dec-08 3:13
professionalAbhijit Jana17-Dec-08 3:13 
GeneralRe: GridView event handler not working Pin
compninja2517-Dec-08 3:38
compninja2517-Dec-08 3:38 
GeneralRe: GridView event handler not working [modified] Pin
compninja2517-Dec-08 3:45
compninja2517-Dec-08 3:45 
GeneralRe: GridView event handler not working Pin
compninja2517-Dec-08 4:12
compninja2517-Dec-08 4:12 
Here's the code:
<pre>
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Xml;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
using System.Collections;

public partial class Subpgs_Warehouse_ShippingCalendar : System.Web.UI.Page
{
public Dictionary<string, string> content1 = new Dictionary<string, string>();

protected void Page_Preload(object sender, EventArgs e)
{
Generate_Table();
}

protected void Page_Load(object sender, EventArgs e)
{
//Generate_Table();
}

protected void Generate_Table()
{
try
{
using (Stream input = File.OpenRead(Server.MapPath("~/Subpgs/Data/Shipping/Calendar.binary")))
{
BinaryFormatter bf = new BinaryFormatter();
content1 = (Dictionary<string, string>)bf.Deserialize(input);
}

}
catch
{

}

int date = 0;

switch (DateTime.Today.DayOfWeek.ToString())
{
case "Sunday":
date = -6;
break;
case "Monday":
date = -7;
break;
case "Tuesday":
date = -8;
break;
case "Wednesday":
date = -9;
break;
case "Thursday":
date = -10;
break;
case "Friday":
date = -11;
break;
case "Saturday":
date = -12;
break;
}

int datelist = date;


DataTable Table1 = new DataTable("last_week");
DataTable Table2 = new DataTable("this_week");
DataTable Table3 = new DataTable("next_week");

DataRow dr1 = Table1.NewRow();
for (int i = 0; i < 5; i++)
{
Table1.Columns.Add(DateTime.Today.AddDays(date).DayOfWeek.ToString() + " " + DateTime.Today.AddDays(date).ToShortDateString(), typeof(string));
try{
dr1[i] = content1[DateTime.Today.AddDays(date).ToShortDateString()];
}
catch{
dr1[i] = "No Data supplied";
}
date++;
}

date += 2;

Table1.Rows.Add(dr1);
DataRow dr2 = Table2.NewRow();

for (int i = 0; i < 5; i++)
{
Table2.Columns.Add(DateTime.Today.AddDays(date).DayOfWeek.ToString() + " " + DateTime.Today.AddDays(date).ToShortDateString(), typeof(string));
try{
dr2[i] = content1[DateTime.Today.AddDays(date).ToShortDateString()];
}
catch{
dr2[i] = "No data supplied";
}
date++;
}

date += 2;

Table2.Rows.Add(dr2);
DataRow dr3 = Table3.NewRow();

for (int i = 0; i < 5; i++)
{
Table3.Columns.Add(DateTime.Today.AddDays(date).DayOfWeek.ToString() + " " + DateTime.Today.AddDays(date).ToShortDateString(), typeof(string));
try{
dr3[i] = content1[DateTime.Today.AddDays(date).ToShortDateString()];
}
catch{
dr3[i] = "No data supplied";
}
date++;
}

Table3.Rows.Add(dr3);

GridView gv1 = new GridView();
gv1.Width = 600;
gv1.DataSource = Table1;
gv1.DataBind();
gv1.HeaderRow.Height = 50;
gv1.HeaderRow.BackColor = System.Drawing.Color.Black;
gv1.HeaderRow.ForeColor = System.Drawing.Color.White;
gv1.RowStyle.Height = 100;

GridView gv2 = new GridView();
gv2.Width = 780;
gv2.DataSource = Table2;
gv2.RowCreated += new GridViewRowEventHandler(gv2_RowCreated);
gv2.DataBind();
switch (DateTime.Today.DayOfWeek.ToString())
{
case "Monday":
gv2.Rows[0].Cells[0].BackColor = System.Drawing.Color.Aqua;
break;
case "Tuesday":
gv2.Rows[0].Cells[1].BackColor = System.Drawing.Color.Aqua;
break;
case "Wednesday":
gv2.Rows[0].Cells[2].BackColor = System.Drawing.Color.Aqua;
break;
case "Thursday":
gv2.Rows[0].Cells[3].BackColor = System.Drawing.Color.Aqua;
break;
case "Friday":
gv2.Rows[0].Cells[4].BackColor = System.Drawing.Color.Aqua;
break;
}

gv2.HeaderRow.Height = 50;
gv2.HeaderRow.BackColor = System.Drawing.Color.Black;
gv2.HeaderRow.ForeColor = System.Drawing.Color.White;
gv2.RowStyle.Height = 175;

GridView gv3 = new GridView();
gv3.Width = 600;
gv3.DataSource = Table3;
gv3.DataBind();
gv3.HeaderRow.Height = 50;
gv3.HeaderRow.BackColor = System.Drawing.Color.Black;
gv3.HeaderRow.ForeColor = System.Drawing.Color.White;
gv3.RowStyle.Height = 100;

Panel1.Controls.Add(gv1);
Panel1.Controls.Add(gv2);
Panel1.Controls.Add(gv3);

if (!Page.IsPostBack)
{
datelist += 7;
for (int i = 0; i < 10; i++)
{
lb1.Items.Add(DateTime.Today.AddDays(datelist).ToShortDateString());
if (i == 4)
{
datelist += 2;
}
datelist++;
}

try
{
input_txt.Text = content1[lb1.SelectedItem.ToString()];
submit1.Text = "Update " + lb1.SelectedItem.ToString();
}
catch
{
input_txt.Text = "";
}
}

}

protected void submit1_Click(object sender, EventArgs e)
{
content1.Remove(lb1.SelectedItem.ToString());
content1.Add(lb1.SelectedItem.ToString(), input_txt.Text);

using (Stream output = File.Create(Server.MapPath("~/Subpgs/Data/Shipping/Calendar.binary")))
{
BinaryFormatter bf = new BinaryFormatter();
bf.Serialize(output, content1);
}
Response.Redirect("~/Subpgs/Warehouse/ShippingCalendar.aspx");
}
protected void lb1_SelectedIndexChanged(object sender, EventArgs e)
{
try
{
input_txt.Text = content1[lb1.SelectedItem.ToString()];
submit1.Text = "Update " + lb1.SelectedItem.ToString();
}
catch
{
submit1.Text = "Update " + lb1.SelectedItem.ToString();
}
}

protected void gv2_RowCreated(object sender, GridViewRowEventArgs e)
{
for (int i = 0; i < 5; i++)
{
e.Row.Cells[i].Text.Replace(Environment.NewLine, "<br />");
}
}
}
</pre>

and here's the aspx:

<pre>
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="ShippingCalendar.aspx.cs" Inherits="Subpgs_Warehouse_ShippingCalendar" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<center>
<asp:Panel ID="Panel1" runat="server">
</asp:Panel><br />
<asp:Panel ID="Panel2" runat="server">
Select Date to change: <asp:DropDownList ID="lb1" runat="server"
AutoPostBack="True" onselectedindexchanged="lb1_SelectedIndexChanged" />
<br />
<asp:TextBox ID="input_txt" runat="server" TextMode="MultiLine" Height="75px" />
<br />
<br />
<asp:Button ID="submit1" runat="server" Text="Update Record"
onclick="submit1_Click" />
</asp:Panel>
</center>
</asp:Content>

</pre>
<pre></pre><pre></pre><pre></pre>

"You're damned if you do, and you're damned if you dont" - Bart Simpson
AnswerRe: GridView event handler not working Pin
Brij17-Dec-08 3:14
mentorBrij17-Dec-08 3:14 
GeneralRe: GridView event handler not working Pin
compninja2517-Dec-08 3:37
compninja2517-Dec-08 3:37 
GeneralRe: GridView event handler not working Pin
Brij17-Dec-08 3:50
mentorBrij17-Dec-08 3:50 
GeneralRe: GridView event handler not working Pin
Abhijit Jana17-Dec-08 3:38
professionalAbhijit Jana17-Dec-08 3:38 
GeneralRe: GridView event handler not working Pin
Brij17-Dec-08 3:48
mentorBrij17-Dec-08 3:48 
AnswerRe: GridView event handler not working Pin
compninja2517-Dec-08 7:09
compninja2517-Dec-08 7:09 
GeneralRe: GridView event handler not working Pin
Abhijit Jana17-Dec-08 17:42
professionalAbhijit Jana17-Dec-08 17:42 
QuestionASP.NET Web Application's dll reference in Web Sites projects Pin
ZiaMehdi17-Dec-08 2:35
ZiaMehdi17-Dec-08 2:35 
AnswerRe: ASP.NET Web Application's dll reference in Web Sites projects Pin
Abhijit Jana17-Dec-08 3:47
professionalAbhijit Jana17-Dec-08 3:47 
AnswerRe: ASP.NET Web Application's dll reference in Web Sites projects Pin
Brij17-Dec-08 4:04
mentorBrij17-Dec-08 4:04 
QuestionRe: ASP.NET Web Application's dll reference in Web Sites projects Pin
ZiaMehdi17-Dec-08 21:34
ZiaMehdi17-Dec-08 21:34 
Questionlimitation for number of Asynchronous threads that we can create using ASP.net Pin
NeetiGulati17-Dec-08 2:29
NeetiGulati17-Dec-08 2:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.