How to update multiple div contents using C#? - c#

In a Get Response from an API, I need to update the div's accordingly.
Below is my HTML Code
<div class="col-md-2 mb-4">
<div class="card mb-4" id="roomName_1" runat="server">
<div class="card-header text-center">
Room 1
</div>
<div class="card-body" style="background-color:#ff0000;color:white;">
<p>
<asp:Literal Text="Organizer" runat="server" ID="organiser_1" />
<br />
<label id="from_1">From</label>
-
<label id="to_1">To</label>
<br />
<asp:Literal Text="Subject" runat="server" ID="subject_1" />
</p>
</div>
</div>
</div>
There are 24 rooms like this, and for each room I have to update Organizer, From, To, Subject which I get from a GET Request.
private void GetRoom(string uri) {
var request = WebRequest.Create(uri);
string text;
var response = (HttpWebResponse)request.GetResponse();
request.ContentType = "application/json; charset=utf-8";
using(var sr = new StreamReader(response.GetResponseStream())) {
text = sr.ReadToEnd();
List<RoomConfigurationViewInfo> roomObject = JsonConvert.DeserializeObject < List<RoomConfigurationViewInfo>> (text);
foreach(var value in roomObject) {
Response.Write(value.Organizer);
Response.Write(value.Subject);
}
}
}
So, Is it possible to Update multiple Div's using C#? & if not then how can I achieve this.
Please suggest.

I found a way that you can achieve this:
At first, add ID to your first tag: <div id="rooms" runat="server" class="col-md-2 mb-4">
Now in code behind, you can try this:
private void GetRoom(string uri)
{
var request = WebRequest.Create(uri);
string text;
var response = (HttpWebResponse)request.GetResponse();
request.ContentType = "application/json; charset=utf-8";
using(var sr = new StreamReader(response.GetResponseStream()))
{
text = sr.ReadToEnd();
List<RoomConfigurationViewInfo> roomObject = JsonConvert.DeserializeObject < List<RoomConfigurationViewInfo>> (text);
rooms.InnerHtml = "";
for(int i = 0; i < roomObject.Count; i++)
{
string strOrganizer = roomObject[i].Organizer;
string strSubject = roomObject[i].Subject;
string strFrom = roomObject[i].From;
string strTo = roomObject[i].To;
rooms.InnerHtml += "<div class=\"card mb-4\">"
+ "<div class=\"card-header text-center\">"
+ "Room " + i + "";
+ "</div>"
+ "<div class=\"card-body\" style=\"background-color:#ff0000;color:white;\">"
+ "<p>"
+ "<asp:Literal Text=\"" + strOrganizer "\" runat=\"server\" ID=\"organiser_" + i + "\"/>"
+ "<br />"
+ "<label>" + strFrom + "</label>"
+ "-"
+ "<label>" + strTo + "</label>"
+ "<br />"
+ "<asp:Literal Text=\"" + strSubject + "\" runat=\"server\" ID=\"subject_" + i + "\" />"
+ "</p>"
+ "</div>"
+ "</div>";
}
}
}
I hope it helps you

It depends if you are doing it dynamically or not. If you are simply loading the page and updating the divs, pass it as a variable and then iterate through it.
Your code on your page would be something like this:
<% foreach (var myItem in g) { %>
<p>
<%= myItem.Organizer%>
<br />
<label id="from_1">From</label>
-
<label id="to_1">To</label>
<br />
<%= myItem.Subject%>
</p>
<% } %>
If you are trying to do it dynamically, the commenter above is correct and you would have to do it through jQuery/Javascript.

Related

Add #Html.DropDownList using Jquery

I have a function that insert a tr/td.
I need to insert a #Html.DropDownList but this code isn't work.
I'm developing a system using C#, bootstrap with Visual Studio.
function AddItem() {
var nItem = Number($("#nItem").val()) + 1;
$("#nItem").val(nItem);
var div = document.createElement('tr');
div.innerHTML = '<td><input type="text" class="item-control" id="Item" name="Item" value="' + nItem + '" style="width:32px;background-color: #e9e9e9;text-align: center" readonly /></td>';
div.innerHTML += '<td colspan="2"><input type="text" class="item-control Qtd" id="Qtd_' + nItem + '" name="Item" value="0" /></td>';
div.innerHTML += '<td colspan="2">#Html.DropDownList("UnMedId", null, "-", htmlAttributes: new { id = "UnMed_", Name = "Item", #class = "form-control" })</td>';
document.getElementById("itens").appendChild(div);
}
Thanks!
Thanks for all.
I use Json in controller and use a loop to create a select.
In controller:
var UnMedId2 = new SelectList(db.UnMeds, "UnMedId", "Simbolo");
ViewBag.UnMedId2 = JsonConvert.SerializeObject(UnMedId2);
In JavaScript:
var sel = '<select name="cars" id="cars">'
var UnMed = #Html.Raw(ViewData["UnMedId2"]);
for (var i = 0; i < UnMed.length; i++) {
sel += '<option value="' + UnMed[i].Value + '">' + UnMed[i].Text + '</option>';
}
sel += '</select >'
Thanks

i want to assign global variable into local varibale but i am getting error. ;expected

public string strSubCat = "";
strCategory += #"<li class='dropdown menu-large nav-item'><a href='# class='dropdown-
toggle nav-link' data-toggle='dropdown'>" + dr["Category_name"] +# </a>
<ul class='dropdown-menu megamenu'>
<div class='row'>
"string subcat1 = null;
subcat1 +=strSubCat + #"
</div>
</ul>
</li>";
Miss some double quotes and ";"
Try this : ?
string strSubCat = "";
strCategory += #"<li class='dropdown menu-large nav-item'><a href='# class='dropdown-
toggle nav-link' data-toggle='dropdown'>" + dr["Category_name"] + #" </a>
<ul class='dropdown-menu megamenu'>
<div class='row'>;
";
string subcat1 = null;
subcat1 +=strSubCat + #"
</div>
</ul>
</li>";

I want to change the list of images based on user selection in JSON and MVC

I'm trying to generate a list on user selection with the help of json in MVC. On page load the list will contain all the images but when the user clicks a link specifying a particular image group. Then images in that group should be shown only.
The problem is however all the images are loaded successfully on page. When I click the linkbutton for particular group it gives me a Json string with that group and redirects to Json actionresult.
Please help I'm very new to using Json.
Razor View:-
#foreach (var item in Model.ImageObj)
{
using (Html.BeginForm("getImageClick", "Home", new { grp = item.ImgGroup }))
{
<button class="btn btn-sm" type="submit" value="#item.ImgGroup" onclick="getImageClick()">#item.ImgGroup </button>
}
}
<div class="clearfix"></div>
<div class="table-bordered" style="margin-top:40px"></div>
<div class="container" style="margin-top:10px">
<div id="status" style="font-size:20px"></div>
<table id="tbl" class="table table-responsive table-hover table-bordered text-center" style="font-size:20px"></table>
<script language="javascript">
$("#status").text("Loading...");
$.get("getImage", null, BindData);
function BindData(Images) {
var tbl = $("#tbl");
for (var j = 0; j <= Images.length; j++) {
var newRow =
"<tr class='col-lg-4 col-md-4 col-sm-12'>" +
"<td>" + "<img src=/images/" + Images[j].Image + " " + 'alt="' + Images[j].Alt + '"' + 'style="width:200px; height:200px"' + 'class="img-thumbnail"' + " />" + "<br />" + Images[j].Description + "</td>" +
"</tr>"
// +
// "<tr class='col-md-4'>" +
//"<td class='col-md-12'>" + Images[j].Description + "</td>" +
//"</tr>"
;
tbl.append(newRow);
}
$("#status").text("Loaded");
}
$.get("getImageClick", null, BindDataNew);
function BindDataNew(ImagesNew) {
var tbl = $("#tbl");
for (var j = 0; j <= ImagesNew.length; j++) {
var newRow =
"<tr class='col-lg-4 col-md-4 col-sm-12'>" +
"<td>" + "<img src=/images/" + ImagesNew[j].Image + " " + 'alt="' + ImagesNew[j].Alt + '"' + 'style="width:200px; height:200px"' + 'class="img-thumbnail"' + " />" + "<br />" + ImagesNew[j].Description + "</td>" +
"</tr>"
// +
// "<tr class='col-md-4'>" +
//"<td class='col-md-12'>" + Images[j].Description + "</td>" +
//"</tr>"
;
tbl.append(newRow);
}
$("#status").text("Loaded");
}
</script>
Controller Methods:-
public ActionResult getImage() //JSON Collection
{
Thread.Sleep(4000);
List<ImageTbl> Images = DbContext.ImageTbls.ToList<ImageTbl>();
return Json(Images, JsonRequestBehavior.AllowGet);
}
public ActionResult getImageClick(string grp) //JSON Collection
{
Thread.Sleep(4000);
List<ImageTbl> ImagesNew = DbContext.ImageTbls.Where(x => x.ImgGroup == grp).ToList<ImageTbl>();
return Json(ImagesNew, JsonRequestBehavior.AllowGet);
}
Even though your button has an onclick event handler, It is inside a form and clicking on that will do a normal form submit. The form's action attribute value is set to getImageClick and it returns JSON data. That is the reason you are seeing json data when you click on the button.
What you should do is, prevent the normal form submit behavior so that it will execute the js code which makes the ajax call and get the data and update the DOM.
Here is the unobtrusive ajax way of doing it.
#foreach (var item in Model.ImageObj)
{
<button class="btn grpBtn"
data-url="#Url.Action("getImageClick", "Home", new { grp = item.ImgGroup})">
#item.ImgGroup
</button>
}
This will add a css class grpBtn to the button.It also add a data attribute called url with value as the relative url to the getImageClick action method with the group in the query string with key grp Now listen to the click event on this button, read the data-url value and make the ajax call to that.
$(function(){
$(document).on("click",".grpBtn",function(e){
e.preventDefault(); //prevents normal link click behavior
$("#tbl").empty(); //clear existing images
$.getJSON($(this).data("url"),function(data){
//loop through the items in data and build the markup for table
$.each(data,function(a,item)
{
var newRow="<tr><td>"+item.Image="</td><tr>"; //Fix this as needed for your use case
$("#tbl").append(newRow);
});
});
});
});

Differentiate between multiple dynamic fileupload controls

I'm dynamically adding multiple fileuploads to my asp.net page.
The user is able to create and delete these fileuploads from the page. The code for this is written in Javascript / JQuery:
var opleverpuntCounter = 0;
function addOpleverpunt() {
var $opleverpuntContainer = $('#opleverpuntContainer');
var div = '';
var divId = 'opleverpunt_' + opleverpuntCounter;
div = '<div id="' + divId + '"><br />Upload afbeelding situatie vooraf <input id="opleverpuntbeforefile_' + opleverpuntCounter + '" name="opleverpuntbeforefile_' + opleverpuntCounter + '" type="file" accept="image/*" capture="camera" /><br /><label for="opleverpuntdescriptionbefore_' + opleverpuntCounter + '">Situatie omschrijving vooraf</label><br /><textarea type="text" id="opleverpuntdescriptionbefore_' + opleverpuntCounter + '" name="opleverpuntdescriptionbefore_' + opleverpuntCounter + '" rows="5" cols="100"></textarea><br />Upload afbeelding situatie achteraf <input id="opleverpuntafterfile_' + opleverpuntCounter + '" name="opleverpuntafterfile_' + opleverpuntCounter + '" type="file" accept="image/*" capture="camera" /><br /><label for="opleverpuntdescriptionafter_' + opleverpuntCounter + '">Situatie omschrijving achteraf</label><br /><textarea type="text" id="opleverpuntdescriptionafter_' + opleverpuntCounter + '" name="opleverpuntdescriptionafter_' + opleverpuntCounter + '" rows="5" cols="100"></textarea><br /><input id="btn_' + opleverpuntCounter + '" type="button" value="REMOVE X" class="smallButton" /></div>';
$opleverpuntContainer.append(div);
$('#btn_' + opleverpuntCounter).click(function () { removeOpleverpunt(divId); });
opleverpuntCounter++;
}
function removeOpleverpunt(element) {
var $element = $('#' + element);
$element.remove();
}
It adds 2 fileupload controls on each addOpleverpunt() call. The name and id are both generated and unique for each fileupload.
HTML:
<div id="opleverpuntContainer">
</div>
Back at server-side I use following code to get and store the uploaded files:
for (int i = 0; i <= Request.Files.Count - 1; i++) {
HttpPostedFile PostedFile = Request.Files(i);
if (PostedFile.ContentLength > 0) {
//Store PostedFile here
//(Left out to improve question readability)
}
}
The fileuploads aren't ASP:FileUpload controls but regular input FileUpload controls.
Is there any way to differentiate between opleverpuntbeforefile_x and opleverpuntafterfile_x? (x is the generated number)
If I'm able to get the difference at serverside, I will be able to store opleverpuntbeforefile in one entity and opleverpuntafterfile in another.
Suggestions and answers in either C# or VB.NET are fine.
You can access the html control name:
for (int i = 0; i <= Request.Files.Count - 1; i++)
{
HttpPostedFile PostedFile = Request.Files[i];
var controlName = Request.Files.Keys[i];
if (PostedFile.ContentLength > 0)
{
//Store PostedFile here
//(Left out to improve question readability)
}
}

how Prevent Twice Page_Load Running - Page.IsPostBack Is always false

in a strange situation my page_Load Runs twice and all of my codes are in page_Load.
i can not use Page.IsPostBac because in both of Page_Loads, it is false.
but what is strange situation ?
i have a page for download files in my project,
when you click on one of download links (i used anchors, so IsPostBack is false) page_Load runs and in page load i check DownloadPath Querystring.
if DownloadPath not be null i jump to a Handler.ashx by passing that DownloadPath for showing Download Window To My Users.
during this process i have some logs in my database and because of that twice running they will be duplicate.
but when twice running accours ?
when you try to download a link by internet download manager, page_Load runs twice!
how can i prevent second runing of page_Load or is there a way for recognize it?
EDIT :
my page_Load :
namespace NiceFileExplorer.en
{
public partial class Download : System.Web.UI.Page
{
public string Folders = "";
public string Files = "";
protected void Page_Load(object sender, EventArgs e)
{
Statistics_body_inside.DataBind();
if (Request.QueryString["Path"] != null)
{
if (Request.QueryString["Path"] == "..")
{
ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "YouCanNotDoThatAnyMore", "YouCanNotDoThatAnyMore();", true);
}
else
{
MainCodes();
}
}
else
{
MainCodes();
}
}
private void MainCodes()
{
if (Request.QueryString["DownloadPath"] != null)
{
string DownloadPath = Request.QueryString["DownloadPath"].ToString();
string FilePath = "C:" + DownloadPath.Replace(#"/", #"\\");
if (Session["User_ID"] != null)
{
string FileName = Request.QueryString["FileName"].ToString();
string FileSize = Request.QueryString["FileSize"].ToString();
string FileCreationDate = Request.QueryString["FileCreationDate"].ToString();
int Downloaded_Count_4Today = DataLayer.Download.Count_By_UserID_Today(int.Parse(HttpContext.Current.Session["User_ID"].ToString()), DateTime.Now);
if (Downloaded_Count_4Today <= 10)
{
DataSet dsDownload = DataLayer.Download.Size_By_UserID_Today(int.Parse(HttpContext.Current.Session["User_ID"].ToString()), DateTime.Now);
if (dsDownload.Tables["Download"].Rows.Count > 0)
{
DataRow drDownload = dsDownload.Tables["Download"].Rows[0];
int SumOfFileSize4Today = int.Parse(drDownload["FileSizSum"].ToString());
if (SumOfFileSize4Today + int.Parse(FileSize) <= 1073741824)//1 GB = 1024*1024*1024 bytes = 1073741824 bytes
//if (SumOfFileSize4Today + int.Parse(FileSize) <= 100000)
{
//DataLayer.Download.InsertRow(
// int.Parse(Session["User_ID"].ToString()),
// DateTime.Now,
// FilePath.Replace(#"\\", #"\"),
// FileName,
// FileSize,
// DateTime.Parse(FileCreationDate)
// );
Response.Redirect("~/HandlerForMyFE.ashx?Downloadpath=" + HttpUtility.UrlEncode(DownloadPath));
}
else
{
ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "YouCanNotDownloadAnyMore_SizeOverload", "YouCanNotDownloadAnyMore_SizeOverload();", true);
}
}
else
{
if (int.Parse(FileSize) <= 1073741824)
//if (int.Parse(FileSize) <= 100000)
{
//DataLayer.Download.InsertRow(
// int.Parse(Session["User_ID"].ToString()),
// DateTime.Now,
// FilePath.Replace(#"\\", #"\"),
// FileName,
// FileSize,
// DateTime.Parse(FileCreationDate)
// );
Response.Redirect("~/HandlerForMyFE.ashx?Downloadpath=" + HttpUtility.UrlEncode(DownloadPath));
}
else
{
ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "YouCanNotDownloadAnyMore_SizeOverload", "YouCanNotDownloadAnyMore_SizeOverload();", true);
}
}
}
else
{
ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "YouCanNotDownloadAnyMore_CountOverload", "YouCanNotDownloadAnyMore_CountOverload();", true);
}
}
else
{
ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "plzLoginFirst_ForDownload", "plzLoginFirst_ForDownload();", true);
}
}
DirectoryInfo dir;
string lastpath = "";
try
{
lastpath = Request["path"].ToString();
}
catch { }
lblTitleInHeader.Text = "Files";
lblTitleInHeader.Text += lastpath;
//set back
string[] splited = lblTitleInHeader.Text.Split('/');
lblTitleInHeader.Text = "";
ArrayList arName = new ArrayList();
for (int i = 0; i < splited.Length; i++)
{
if (splited[i] != "")
{
arName.Add(splited[i]);
}
}
for (int i = 0; i < arName.Count - 1; i++)
{
if (i != arName.Count - 1)
{
lblTitleInHeader.Text += "<a href='Download.aspx?path=%2f";//%2f = /
for (int j = 1; j < i + 1; j++)
{
lblTitleInHeader.Text += HttpUtility.UrlEncode(arName[j].ToString() + "/");
}
lblTitleInHeader.Text += "'>" + arName[i] + "</a>" + " " + "<img class='icoSubFolder' src='../Images/Download/icoSubFolder.png' />";
}
}
lblTitleInHeader.Text += arName[arName.Count - 1].ToString();
lblTitleInHeader.Text = lblTitleInHeader.Text.Replace("/'>", "'>");
if (lastpath != "")
{
//dir = new DirectoryInfo(Server.MapPath("~/Files/" + lastpath));
dir = new DirectoryInfo(#"C:\\Files\\" + lastpath.Replace(#"/", #"\\"));
}
else
{
//dir = new DirectoryInfo(Server.MapPath("~/Files/"));
dir = new DirectoryInfo(#"C:\\Files\\");
}
int count4Folders = 0;
foreach (DirectoryInfo d in dir.GetDirectories())
{
count4Folders++;
DirectoryInfo dirSub = new DirectoryInfo(d.FullName);
int iDir = 0;
int iFile = 0;
foreach (DirectoryInfo subd in dirSub.GetDirectories())
{
iDir++;
}
foreach (FileInfo f in dirSub.GetFiles("*.*"))
{
iFile++;
}
Folders += "<div class='divFoldersBody_Row'>";
Folders += "<div class='divFoldersBody_Left'>";
Folders += " ";
Folders += "</div>";
Folders += "<div class='divFoldersBody_Name'>";
Folders += "<span class='imgFolderContainer'><img class='imgFolder' src='../Images/Download/folder.png' /></span>";
Folders += "<span class='FolderName'><a class='FolderLink' href='Download.aspx?path=" + HttpUtility.UrlEncode(lastpath + "/" + d.Name) + "'>";
Folders += d.Name;
Folders += "</a></span>";
Folders += "</div>";
Folders += "<div class='divFoldersBody_Count'>";
Folders += iDir.ToString() + " Folders & " + iFile.ToString() + " Files";
Folders += "</div>";
Folders += "<div class='divFoldersBody_Right'>";
Folders += " ";
Folders += "</div>";
Folders += "</div>";
}
if (count4Folders == 0)
{
divFoldersHeader.Style.Add("display", "none");
}
int count4Files = 0;
foreach (FileInfo f in dir.GetFiles("*.*"))
{
count4Files++;
Files += "<div class='divFilesBody_Row'>";
Files += "<div class='divFilesBody_Left'>";
Files += " ";
Files += "</div>";
Files += "<div class='divFilesBody_Name'>";
char[] Extension_ChAr = f.Extension.ToCharArray();
string Extension_str = string.Empty;
int lenghth = Extension_ChAr.Length;
for (int i = 1; i < Extension_ChAr.Length; i++)
{
Extension_str += Extension_ChAr[i];
}
if (Extension_str.ToLower() == "rar" || Extension_str.ToLower() == "zip" || Extension_str.ToLower() == "zipx" || Extension_str.ToLower() == "7z" || Extension_str.ToLower() == "cat")
{
Files += "<span class='imgFileContainer'><img class='imgFile-rar' src='../Images/Download/file-rar.png' /></span>";
}
else if (Extension_str.ToLower() == "txt" || Extension_str.ToLower() == "doc" || Extension_str.ToLower() == "docx")
{
Files += "<span class='imgFileContainer'><img class='imgFile-txt' src='../Images/Download/file-txt.png' /></span>";
}
else if (Extension_str.ToLower() == "pdf")
{
Files += "<span class='imgFileContainer'><img class='imgFile-pdf' src='../Images/Download/file-pdf.png' /></span>";
}
else if (Extension_str.ToLower() == "jpg" || (Extension_str.ToLower() == "png") || (Extension_str.ToLower() == "gif") || (Extension_str.ToLower() == "bmp") || (Extension_str.ToLower() == "psd"))
{
Files += "<span class='imgFileContainer'><img class='imgFile-image' src='../Images/Download/file-image.png' /></span>";
}
else if (Extension_str.ToLower() == "exe")
{
Files += "<span class='imgFileContainer'><img class='imgFile-exe' src='../Images/Download/file-exe.png' /></span>";
}
else
{
Files += "<span class='imgFileContainer'><img class='imgFile-unknown' src='../Images/Download/file-unknown.png' /></span>";
}
Files += "<span title='" + f.Name + "' class='FileName'>";
Files += f.Name;
Files += "</span>";
Files += "</div>";
Files += "<div class='divFilesBody_FileType'>";
Files += "<span style='color:red;'>" + Extension_str.ToUpper() + "</span>" + " File";
//Files += Path.GetExtension(f.Name) + " File";
Files += "</div>";
Files += "<div class='divFilesBody_FileSize'>";
Files += ConvertBytes.ToFileSize(long.Parse(f.Length.ToString()));
Files += "</div>";
Files += "<div class='divFilesBody_FileCreationDate'>";
Files += f.CreationTime;
Files += "</div>";
Files += "<div class='divFilesBody_FileDownload'>";
string Downloadpath = "/Files" + lastpath + "/" + f.Name;
string EncodedDownloadpath = HttpUtility.UrlEncode(Downloadpath);
Files += "<a class='FileLink' href='Download.aspx?path=" + HttpUtility.UrlEncode(lastpath) + "&Downloadpath=" + EncodedDownloadpath + "&FileName=" + HttpUtility.UrlEncode(f.Name) + "&FileSize=" + HttpUtility.UrlEncode(f.Length.ToString()) + "&FileCreationDate=" + HttpUtility.UrlEncode(f.CreationTime.ToString()) + "'>";
Files += "<img class='imgDownload' src='../Images/Download/Download.png' />";
Files += "</a>";
Files += "</div>";
Files += "<div class='divFilesBody_Right'>";
Files += " ";
Files += "</div>";
Files += "</div>";
}
if (count4Files == 0)
{
divFilesHeader.Style.Add("display", "none");
}
if ((count4Folders == 0) && (count4Files == 0))
{
divFoldersHeader.Style.Add("display", "block");
divFilesHeader.Style.Add("display", "block");
}
ScriptManager.RegisterStartupScript(this, this.GetType(), "hash", "location.hash = '#BreadCrumbInDownload';", true);
}
....
my aspx :
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<link href="css/Download.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
$(function () {
$('#Download-body *').css({ 'zIndex': 2 });
$('#Download-body').css({ 'overflow': 'hidden', 'position': 'relative' });
var containerWidth = $('#Download-body').innerWidth();
var containerHeight = $('#Download-body').innerHeight();
var bgimgurl = $('#Download-body').css('backgroundImage').replace(/url\(|\)|"|'/g, "");
var img = $('<img src="' + bgimgurl + '" width="' + containerWidth + 'px"' + ' height="' + containerHeight + 'px" />').css({ 'position': 'absolute', 'left': 0, 'top': 0, 'zIndex': 1 });
$('#Download-body').css({ 'background': 'transparent' }).append(img);
});
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<div id="Download">
<div id="Download-header">
<div id="DownloadTitle">
Download
</div>
<asp:Image ID="imgDownload_header_left" runat="server" ImageUrl="~/Images/Download-header-left.png" />
<asp:Image ID="imgDownload_header_right" runat="server" ImageUrl="~/Images/Download-header-right.png" />
</div>
<div id="Download-body">
<div id="Download-body-inside">
<div id="Statistics">
<div id="Statistics-header">
<div id="StatisticsTitle">
Statistics
</div>
<asp:Image ID="imgStatistics_header_left" runat="server" ImageUrl="~/Images/Statistics-header-left.png" />
<asp:Image ID="imgStatistics_header_right" runat="server" ImageUrl="~/Images/Statistics-header-right.png" />
</div>
<div id="Statistics-body">
<div runat="server" id="Statistics_body_inside">
<asp:Label ID="lblDownload_Count_By_UserID_Title" runat="server" Text="Ur Download Count :"
ToolTip="Your Download Count From The Begining Of Registration UpTo Now" CssClass="lblTitleInStatistics"></asp:Label>
<asp:Label ID="lblDownload_Count_By_UserID" runat="server" Text="<%# Download_Count_By_UserID() %>"
CssClass="lblCountInStatistics"></asp:Label>
<br />
<asp:Label ID="lblDownload_Count_By_UserID_Today_Title" runat="server" Text="Ur Download Count-Today :"
ToolTip="Your Download Count-Today" CssClass="lblTitleInStatistics"></asp:Label>
<asp:Label ID="lblDownload_Count_By_UserID_Today" runat="server" Text="<%# Download_Count_By_UserID_Today() %>"
CssClass="lblCountInStatistics"></asp:Label>
<br />
<asp:Label ID="lblDownload_Size_By_UserID_Title" runat="server" Text="Ur Download Size :"
ToolTip="Your Download Size From The Begining Of Registration UpTo Now" CssClass="lblTitleInStatistics"></asp:Label>
<asp:Label ID="lblDownload_Size_By_UserID" runat="server" Text="<%# Download_Size_By_UserID() %>"
CssClass="lblCountInStatistics"></asp:Label>
<br />
<asp:Label ID="lblDownload_Size_By_UserID_Today_Title" runat="server" Text="Ur Download Size-Today :"
ToolTip="Your Download Size-Today" CssClass="lblTitleInStatistics"></asp:Label>
<asp:Label ID="lblDownload_Size_By_UserID_Today" runat="server" Text="<%# Download_Size_By_UserID_Today() %>"
CssClass="lblCountInStatistics"></asp:Label>
<br />
<asp:Label ID="lblDownload_Size_By_UserID_Today_Remain_Title" runat="server" Text="Ur Remain Download Size-Today :"
ToolTip="Your Remain Download Size-Today" CssClass="lblTitleInStatistics"></asp:Label>
<asp:Label ID="lblDownload_Size_By_UserID_Today_Remain" runat="server" Text="<%# Download_Size_By_UserID_Today_Remain() %>"
CssClass="lblCountInStatistics"></asp:Label>
</div>
</div>
</div>
<div id="MainDivInDownload">
<div id="BreadCrumbInDownload">
<div id="imgicoHomeContainer">
<asp:Image ID="imgicoHome" runat="server" ImageUrl="~/Images/Download/icoHome.png" />
</div>
<div id="lblTitleInHeaderContainer">
<asp:Label ID="lblTitleInHeader" runat="server" Text=""></asp:Label>
</div>
<div style="clear: both;">
</div>
</div>
<div runat="server" id="divFolders">
<div runat="server" id="divFoldersHeader">
<div id="divFoldersHeader_Left">
<asp:Image ID="divFoldersHeader_imgLeft" runat="server" ImageUrl="~/Images/Download/divsHeader_Left.png" />
</div>
<div id="divFoldersHeader_Name">
Folders In This Folder
</div>
<div id="divFoldersHeader_Count">
Total Files In This Folder
</div>
<div id="divFoldersHeader_Right">
<asp:Image ID="divFoldersHeader_imgRight" runat="server" ImageUrl="~/Images/Download/divsHeader_Right.png" />
</div>
</div>
<div id="divFoldersBody">
<%-- <div class="divFoldersBody_Row">
<div class="divFoldersBody_Left">
</div>
<div class="divFoldersBody_Name">
<span class="imgFolderContainer">
<asp:Image CssClass="imgFolder" runat="server" ImageUrl="~/Images/Download/folder.png" />
</span><span class="FolderName"><a class="FolderLink" href="#">Folders In This Folder</a></span>
</div>
<div class="divFoldersBody_Count">
Total Files In This Folder
</div>
<div class="divFoldersBody_Right">
</div>
</div>--%>
<%= Folders %>
</div>
</div>
<div runat="server" id="divFiles">
<div runat="server" id="divFilesHeader">
<div id="divFilesHeader_Left">
<asp:Image ID="divFilesHeader_imgLeft" runat="server" ImageUrl="~/Images/Download/divsHeader_Left.png" />
</div>
<div id="divFilesHeader_Name">
Files In This Folder
</div>
<div id="divFilesHeader_FileType">
File Type
</div>
<div id="divFilesHeader_FileSize">
File Size
</div>
<div id="divFilesHeader_FileCreationDate">
File Creation Date
</div>
<div id="divFilesHeader_FileDownload">
</div>
<div id="divFilesHeader_Right">
<asp:Image ID="divFilesHeader_imgRight" runat="server" ImageUrl="~/Images/Download/divsHeader_Right.png" />
</div>
</div>
<div id="divFilesBody">
<%-- <div class="divFilesBody_Row">
<div class="divFilesBody_Left">
</div>
<div class="divFilesBody_Name">
<span class="imgFileContainer">
<asp:Image runat="server" ImageUrl="~/Images/Download/file.png" CssClass="imgFile" />
</span><span class="FileName">Files In This Folder</span>
</div>
<div class="divFilesBody_FileType">
File Type
</div>
<div class="divFilesBody_FileSize">
File Size
</div>
<div class="divFilesBody_FileCreationDate">
File Creation Date
</div>
<div class="divFilesBody_FileDownload">
<a class="FileLink" href="#">
<asp:Image CssClass="imgDownload" runat="server" ImageUrl="~/Images/Download.png" />
</a>
</div>
<div class="divFilesBody_Right">
</div>
</div>--%>
<%= Files %>
</div>
</div>
</div>
</div>
</div>
</div>
</asp:Content>
thanks in advance
Please look at the html as it is rendered on the page:
Every time it's present
<img src=""/>
double postback can happen, for some browser...
If this is the trouble, you can resolve it setting a default, blank, image for every button
<asp:ImageButton ImageUrl="~/Images/blank.gif"...

Categories