Using ASP.NET 4.5 in C# Customize at least 3 Individual days in the Calendar The
ID: 3693404 • Letter: U
Question
Using ASP.NET 4.5 in C# Customize at least 3 Individual days in the Calendar These are inside the individual day cells.
1) Create a date on the web site in the current month that is important.
a. You will need some text, a very small image (16px)
b. You can make your own image or alter one from the LOC web site.
c. You will need the web address of the page you visited to document where you got the image from.
d. You will need some fact or information from the site. (Very short!)
2) On one day display a text message with a LiteralControl that contains some HTML code. The text should be some ‘fact’ from LOC
3) On one day display a text HyperLink that will take you to the page that you looked up.
4) On one day display an Image. Make sure to provide alternative text and configure the target attribute.
Explanation / Answer
using system.Data.SqlClient;
for image insert, code c#:
protected voidUploadFile(objectsender, EventArgs e)
{
string filename =Path.GetFileName(FileUpload1.PostedFile.FileName);
stringcontentType = FileUpload1.PostedFile.ContentType;
using (Stream fs = FileUpload1.PostedFile.InputStream)
{
using(BinaryReader br =new BinaryReader(fs))
{
byte[] bytes = br.ReadBytes((Int32)fs.Length);
stringconstr =ConfigurationManager.ConnectionStrings["constr"].ConnectionString;
using(MySqlConnection con = newMySqlConnection(constr))
{
string query = "INSERT INTO Files(FileName, ContentType, Content) VALUES (@FileName, @ContentType, @Content)";
using (MySqlCommandcmd = newMySqlCommand(query))
{
cmd.Connection = con;
cmd.Parameters.AddWithValue("@FileName", filename);
cmd.Parameters.AddWithValue("@ContentType", contentType);
cmd.Parameters.AddWithValue("@Content", bytes);
con.Open();
cmd.ExecuteNonQuery();
con.Close();
}
}
}
}
Response.Redirect(Request.Url.AbsoluteUri);
}
for display the image:
protected voidOnRowDataBound(objectsender,GridViewRowEventArgse)
{
if(e.Row.RowType ==DataControlRowType.DataRow)
{
byte[] bytes = (byte[])(e.Row.DataItem asDataRowView)["Content"];
stringbase64String =Convert.ToBase64String(bytes, 0, bytes.Length);
(e.Row.FindControl("Image1") asImage).ImageUrl ="data:image/png;base64,"+ base64String;
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.