Showing posts with label area. Show all posts
Showing posts with label area. Show all posts

Wednesday, March 28, 2012

The best way to display a panel of ads?

Hey everyone,

I am developing an online store application. I got stuck in one thing, which is how to build an ad area in the home page. For example: if you go to amazon.com you will see in top or in the side an area with let say 20 different ads (Dell,Microsoft,cingular, Sears, TJMAX,etc …..)For different companies. Each ad will appear randomly every 5 seconds. What is the best and most efficient way to accomplish such thing? And would you please provide me with an example!. Also can I have flash ad integrated in my VS2005 application? I am using ASP.Net 2.0

Your input will be truly appreciated!

i am going out on a limb here, because i have yet to really experiment with this. so i cannot testify to its usefulness nor can i provide any examples, but this may be what you are looking for. throw this link into your browser and check it out:

ms-help://MS.VSExpressCC.v80/MS.NETFramework.v20.en/dv_vwdcon/html/a307f03e-6bbd-4ec3-96ef-5b7188ba5eb9.htm

but, i came across this one day and marked it in my fav's to get back to once i am finished with the project i am currently on. hope it helps, and if it does, let me know.

thanks and good luck


http://aspnet.4guysfromrolla.com/articles/033104-1.aspx

Hope above will be helpful.


Google out about the ASP.NET 2.0 AdRotator control. Its XML based & easy to implement & handle.


I guess using Ad Rotator will be the best option.

However, you will get a new ad on after the page gets refreshed. Basically it will get ad from either an XML file (if u wish to have static list and can edit it manually) else ads can come from DB. You can have a small screen to add Ads.

Popo


Pls check outwww.constructionkerala.com......

using System;

using System.Data;

using System.Configuration;

using System.Collections;

using System.Web;

using System.Web.Security;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Web.UI.WebControls.WebParts;

using System.Web.UI.HtmlControls;

publicpartialclassMasterPage : System.Web.UI.MasterPage

{

protectedvoid Page_Load(object sender,EventArgs e)

{

GridView1.PageSize =Utilities.ToInt(ConfigurationManager.AppSettings["subListCount"]);

if (Request.QueryString["td"] !=null && Request.QueryString["td"].Trim() !="")

hidSelectedTd.Value ="td_" + Request.QueryString["td"];

int subCategory=Request.QueryString["sub"]==null || Request.QueryString["sub"]=="" ? 0:Utilities.ToInt(Request.QueryString["sub"]);

System.Collections.Generic.List<Advertisement> advList =Advertisement.SelectAll(subCategory,Location.Top.ToString());

if (advList.Count > 0)

litImage.Text =Advertisement.BindAdds(advList[0].Image, advList[0].Width.ToString(), advList[0].Height.ToString());

}

protectedvoid GridView1_DataBound(object sender,EventArgs e)

{

Session["sub"] = GridView1.DataKeys[0][0];

}

protectedvoid lnkSearch_Click(object sender,EventArgs e)

{

if (txtSearch.Text !="")

Response.Redirect("SearchResult1.aspx?cont="+txtSearch.Text +"&type=" + cmbSearch.Text);

}

}

=======================

<%@dotnet.itags.org.MasterLanguage="C#"AutoEventWireup="true"CodeFile="MasterPage.master.cs"Inherits="MasterPage" %>

<!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<htmlxmlns="http://www.w3.org/1999/xhtml">

<headrunat="server">

<title>.:Master:.</title>

<script>

var subCat=0;

function onSubMouseOver(e){

document.getElementById(e.id).style.background="url(images/subOver.jpg)";

document.getElementById(e.id).style.backgroundRepeat="no-repeat"

document.getElementById("divToolTip").style.visibility="visible";

document.getElementById("divToolTip").innerHTML=document.getElementById(e.id).innerHTML;

document.getElementById("divToolTip").style.left=event.x+10;

document.getElementById("divToolTip").style.top=event.y+5;

}

function onSubMouseOut(e){

document.getElementById(e.id).style.background="url(images/subNormal.jpg)";

document.getElementById(e.id).style.backgroundRepeat="no-repeat"

document.getElementById("divToolTip").style.visibility="hidden";

}

function window_onload() {

document.getElementById("divToolTip").style.visibility="hidden";

document.getElementById("divImages").style.visibility="hidden";

}

function onSubCategory(url){

aspnetForm.action=url;

aspnetForm.submit();

}

</script>

<script>

var img="";

var imgLeft="";

var imgRight="";

var tdLeft;

var tdRight;

function link_onMouse(link){

selTdId=document.getElementById("<%=hidSelectedTd.ClientID%>").value;

selTd=document.getElementById(selTdId);

if(link.id==selTdId)

return;

tdLeft=document.getElementById("td_" + (parseInt(link.id.split("_")[1])-1).toString());

tdRight=document.getElementById("td_" + (parseInt(link.id.split("_")[1])+1).toString());

//Store current Styles

img=link.style.backgroundImage;

imgLeft=tdLeft.style.backgroundImage;

imgRight=tdRight.style.backgroundImage;

//set New Style

//Current

link.style.backgroundImage="url(linkImages/link_Over.jpg)";

//Left

if(link.id=="td_10")//Search

tdLeft.style.backgroundImage="url(linkImages/search_Over_L.jpg)";

elseif(link.id=="td_12" && selTdId=="td_10")//Login

tdLeft.style.backgroundImage="url(linkImages/search_Sel_login_Over.jpg)";

elseif(link.id=="td_12")//Login

tdLeft.style.backgroundImage="url(linkImages/login_Over_L.jpg)";

elseif(link.id=="td_14" && selTdId!="td_12")//Feedback

tdLeft.style.backgroundImage="url(linkImages/feedback_Over_L.jpg)";

elseif("td_" + (parseInt(tdLeft.id.split("_")[1])-1).toString()==document.getElementById("<%=hidSelectedTd.ClientID%>").value)

tdLeft.style.backgroundImage="url(linkImages/linkOver_L_Sel_R.jpg)";

else

tdLeft.style.backgroundImage="url(linkImages/linkOver_L.jpg)";

//Right

if(link.id=="td_10" && selTdId!="td_12")//Search

tdRight.style.backgroundImage="url(linkImages/search_Over_R.jpg)";

elseif(link.id=="td_10" && selTdId=="td_12")

tdRight.style.backgroundImage="url(linkImages/search_Over_login_Sel.jpg)";

elseif(link.id=="td_12" && selTdId!="td_14")//Login

tdRight.style.backgroundImage="url(linkImages/login_Over_R.jpg)";

elseif(link.id=="td_12" && selTdId!="td_14")

tdRight.style.backgroundImage="url(linkImages/login_Over_fdbk_Sel.jpg)";

elseif(link.id=="td_7")

tdRight.style.backgroundImage="url(linkImages/link_firstEnd_R_Over.jpg)";

elseif(link.cellIndex+2==selTd.cellIndex)

tdRight.style.backgroundImage="url(linkImages/linkOver_R_Sel_R.jpg)";

else

tdRight.style.backgroundImage="url(linkImages/linkOver_R.jpg)";

}

function link_onMouseOut(link){

selTdId=document.getElementById("<%=hidSelectedTd.ClientID%>").value;

if(link.id==selTdId)

return;

link.style.backgroundImage=img;

tdLeft.style.backgroundImage=imgLeft;

tdRight.style.backgroundImage=imgRight;

}

function Search(){

// var val=document.getElementById("<%=txtSearch.ClientID%>").value;

// //val = val.replace(/^\s*/,"");

// //val = val.replace(/\s*$/,"");

// while(val.indexOf("'")>-1)

// val = val.replace("'","");

// if(val != ""){

// var field=document.getElementById("<%=cmbSearch.ClientID%>").value;

// // var sub=<%=Request.QueryString["sub"]==null || Request.QueryString["sub"]=="" ? "0" : Request.QueryString["sub"] %>

//aspnetForm.action="SearchResults.aspx?td=10&field=" + field + "&val=" + val + "&sub=" + sub ;

aspnetForm.action="sa.aspx";

aspnetForm.submit();

//}

}

</script>

<linkhref="StyleSheet2.css"rel="stylesheet"type="text/css"/>

<metaname="keywords"content="Construction Kerala, Construction, About Construction,About Construction Kerala, Intellectual Publications , All Kerala Building Materials And Construction Dictionary, Building Materials And Construction Dictionary"/>

<metaname="Description"content="We are confident that continued cooperaton of our customers, we shall bring out exhaustive and timely editions of ABCD year after year."/>

</head>

<bodyleftmargin="0"topmargin="0"rightmargin="0"bottommargin="0"language="javascript"onload="return window_onload()">

<formid="form1"runat="server">

<div>

<tablealign="center"bgcolor="#ffffff"border="0"cellpadding="0"cellspacing="0"

style="width: 760px; height: 420px">

<tr>

<tdcolspan="3"height="72">

<tableborder="0"cellpadding="0"cellspacing="0"style="width: 100%; height: 72px">

<tr>

<tdwidth="240">

<imgsrc="images/banner_01.jpg"/></td>

<tdbgcolor="#ffd078"width="100%"align="center">

<asp:LiteralID="litImage"Text=""runat="server"></asp:Literal>

</td>

<tdwidth="284">

<imgsrc="images/banner_03.jpg"/></td>

</tr>

</table>

</td>

</tr>

<tr>

<tdcolspan="3"height="5">

</td>

</tr>

<tr>

<tdcolspan="2"height="18"style="padding-left: 4px">

<tableborder="0"cellpadding="0"cellspacing="0"width="100%">

<trheight="18">

<tdid="td_1"style="background-image: url(linkImages/linkhome_L.jpg); width: 3px;

background-repeat: repeat-x">

<ahref="Default.aspx">

<imgalt="Home"border="0"src="linkImages/home.jpg"style="text-decoration: underline"/></a>

</td>

<tdid="td_2"class="linkNormalRight"style="color: #000000">

</td>

<tdid="td_3"align="center"class="linkNormal"onmouseout="link_onMouseOut(this)"

onmouseover="link_onMouse(this)"style="color: #000000">

<ahref="CompanyList.aspx?cat=1&td=3"title="Services">Products</a>

</td>

<tdid="td_4"class="linkNormalRight">

</td>

<tdid="td_5"align="center"class="linkNormal"onmouseout="link_onMouseOut(this)"

onmouseover="link_onMouse(this)">

<ahref="CompanyList.aspx?cat=2&td=5"title="Products">Services</a>

</td>

<tdid="td_6"class="linkNormalRight">

</td>

<tdid="td_7"align="center"class="linkNormal"onmouseout="link_onMouseOut(this)"

onmouseover="link_onMouse(this)">

<ahref="Aboutus.aspx?td=7"title="About Us">About Us</a>

</td>

<tdid="td_8"class="linkFirstEndNormal">

</td>

<!-- Search -->

<tdbgcolor="#d0d0d0"style="background-image: url(linkImages/search_Left.jpg); background-repeat: no-repeat;

height: 18px"align="center">

<asp:TextBoxID="txtSearch"runat="server"CssClass="search"Height="15px"Width="50%"></asp:TextBox>

in

<asp:DropDownListID="cmbSearch"runat="server"CssClass="cmb"Height="15px"Width="30%">

<asp:ListItemValue="Title">Name</asp:ListItem>

<asp:ListItem>Place</asp:ListItem>

<asp:ListItem>District</asp:ListItem>

</asp:DropDownList>

</td>

<tdid="td_9"style="background-image: url(linkImages/search_L.jpg); width: 4px;

background-repeat: no-repeat">

</td>

<tdid="td_10"align="center"class="linkNormal"onmouseout="link_onMouseOut(this)"

onmouseover="link_onMouse(this)">

<asp:LinkButtonID="lnkSearch"runat="server"ForeColor="black"OnClick="lnkSearch_Click"CausesValidation="False">Search</asp:LinkButton>

</td>

<tdid="td_11"style="font-size: 8pt; background-image: url(linkImages/search_R.jpg);

width: 22px; background-repeat: repeat-x">

</td>

<!-- Last Links -->

<tdid="td_12"align="center"class="linkNormal"onmouseout="link_onMouseOut(this)"

onmouseover="link_onMouse(this)"style="font-size: 8pt">

<ahref="UserLogin.aspx?td=12"title="Login">Login</a>

</td>

<tdid="td_13"style="background-image: url(linkImages/login_R.jpg); width: 16px;

background-repeat: no-repeat">

</td>

<tdid="td_14"align="center"class="linkNormal"onmouseout="link_onMouseOut(this)"

onmouseover="link_onMouse(this)">

<ahref="feedback.aspx?td=14&sub=<%=Request.QueryString["sub"]%>"title="Feedback">Feedback</a>

</td>

<tdid="td_15"style="background-image: url(linkImages/feedback_R.jpg); width: 3px;

background-repeat: no-repeat">

</td>

</tr>

</table>

</td>

<tdbgcolor="#f5f2f2"rowspan="2"width="144"valign="top"align="center">

<asp:DataListID="dlstAdds"runat="server"DataSourceID="odsAdds">

<ItemTemplate>

<%#Advertisement.BindAdds((string)Eval("Image"),Eval("Width").ToString(),Eval("Height").ToString())%>

</ItemTemplate>

</asp:DataList><asp:ObjectDataSourceID="odsAdds"runat="server"SelectMethod="SelectAll"

TypeName="Advertisement">

<SelectParameters>

<asp:QueryStringParameterName="subDirectoryID"QueryStringField="sub"Type="Int32"/>

<asp:ParameterDefaultValue="R"Name="location"Type="String"/>

</SelectParameters>

</asp:ObjectDataSource>

</td>

</tr>

<tr>

<tdstyle="background-image: url(images/subBack.jpg); background-repeat: repeat-y"

valign="top"width="144">

<asp:GridViewID="GridView1"DataKeyNames="ID"runat="server"AllowPaging="True"

AutoGenerateColumns="False"CellPadding="0"DataSourceID="odsSubcategory"GridLines="None"

PageSize="3"ShowFooter="True"ShowHeader="False"Width="144px"OnDataBound="GridView1_DataBound">

<Columns>

<asp:TemplateField>

<ItemTemplate>

<ahref="javascript:onSubCategory('CompanyList.aspx?sub=<%#Eval("ID")%><%=Request.QueryString["cat"]!=null && Request.QueryString["cat"]!=""?"&cat="+Request.QueryString["cat"]:"" %>&td=<%=Request.QueryString["td"] %>')">

<divid='divItem<%#Eval("ID") %>'class="divItemNormal"onmouseout="onSubMouseOut(this)"

onmouseover="onSubMouseOver(this)">

<%#Eval("Name") %>

</div>

</a>

<script>

if(subCat==0)

subCat=<%#Eval("ID") %>;

</script>

</ItemTemplate>

<FooterTemplate>

<%if (Request.QueryString["sub"] ==null && Request.QueryString.Count>0)

{%>

<script>

try{

document.getElementById("divItem<%=GridView1.DataKeys[0][0]%>").className="divItemSelected";

document.getElementById("divItem<%=GridView1.DataKeys[0][0]%>").onmouseover="";

document.getElementById("divItem<%=GridView1.DataKeys[0][0]%>").onmouseout="";

}

catch(e){}

</script>

<%}

else

{ %>

<script>

try{

document.getElementById("divItem<%=Request.QueryString["sub"]%>").className="divItemSelected";

document.getElementById("divItem<%=Request.QueryString["sub"]%>").onmouseover="";

document.getElementById("divItem<%=Request.QueryString["sub"]%>").onmouseout="";

}

catch(e){}

</script>

<%} %>

</FooterTemplate>

</asp:TemplateField>

</Columns>

<PagerStyleCssClass="subFooter"HorizontalAlign="Right"/>

<PagerSettingsFirstPageImageUrl="~/images/btnFirst.jpg"LastPageImageUrl="~/images/btnLast.jpg"

Mode="NextPreviousFirstLast"NextPageImageUrl="~/images/btnNext.jpg"PreviousPageImageUrl="~/images/btnPrev.jpg"/>

</asp:GridView>

</td>

<tdstyle="padding-right: 5px; padding-left: 5px; padding-bottom: 3px; padding-top: 5px"

valign="top"width="472"height="225">

<asp:ContentPlaceHolderID="ContentPlaceHolder1"runat="server">

</asp:ContentPlaceHolder>

</td>

</tr>

<tr>

<tdcolspan="3"height="25"style="padding-left: 5px; background-color: #ffcc66">

<spanstyle="font-family: Times New Roman">?</span>

2007 constructionkerala.com.

All rights reserved. <br/>

<spanstyle="font-size: 8pt">Site Designed and maintained by<ahref="http://www.infoprismsolutions.com"

style="color: #ffffff"target="_blank">infoprismsolutions.com</a></span>

</td>

</tr>

</table>

</div>

<asp:ObjectDataSourceID="odsSubcategory"runat="server"SelectMethod="SelectAll"

TypeName="SubCategory">

<SelectParameters>

<asp:QueryStringParameterDefaultValue="1"Name="categoryID"QueryStringField="cat"

Type="Int32"/>

</SelectParameters>

</asp:ObjectDataSource>

<asp:HiddenFieldID="hidSelectedTd"runat="server"Value="td_3"/>

<br/>

<divid="divToolTip"style="left: 5px; top: 507px">

</div>

<divid="divImages"style="visibility:hidden;">

<imgsrc="images/subOver.jpg"/><imgsrc="linkImages/feedback_Over_L.jpg"/>

<imgsrc="linkImages/feedback_R.jpg"/>

<imgsrc="linkImages/feedback_Sel_L.jpg"/>

<imgsrc="linkImages/feedback_Sel_R.jpg"/>

<imgsrc="linkImages/link.jpg"/>

<imgsrc="linkImages/link_firstEnd_R.jpg"/>

<imgsrc="linkImages/link_firstEnd_R_Over.jpg"/>

<imgsrc="linkImages/link_firstEnd_R_Sel.jpg"/>

<imgsrc="linkImages/link_L.jpg"/>

<imgsrc="linkImages/link_Over.jpg"/>

<imgsrc="linkImages/link_R.jpg"/>

<imgsrc="linkImages/link_Sel.jpg"/>

<imgsrc="linkImages/linkhome_L.jpg"/>

<imgsrc="linkImages/linkOver_L.jpg"/>

<imgsrc="linkImages/linkOver_L_Sel_R.jpg"/>

<imgsrc="linkImages/linkOver_R.jpg"/>

<imgsrc="linkImages/linkOver_R_Sel_R.jpg"/>

<imgsrc="linkImages/linkSelected_L.jpg"/>

<imgsrc="linkImages/linkSelected_R.jpg"/>

<imgsrc="linkImages/login_Over_fdbk_Sel.jpg"/>

<imgsrc="linkImages/login_Over_L.jpg"/>

<imgsrc="linkImages/login_Over_R.jpg"/>

<imgsrc="linkImages/login_R.jpg"/>

<imgsrc="linkImages/login_Sel_L.jpg"/>

<imgsrc="linkImages/login_Sel_R.jpg"/>

<imgsrc="linkImages/search_L.jpg"/>

<imgsrc="linkImages/search_Left.jpg"/>

<imgsrc="linkImages/search_Over_L.jpg"/>

<imgsrc="linkImages/search_Over_login_Sel.jpg"/>

<imgsrc="linkImages/search_Over_R.jpg"/>

<imgsrc="linkImages/search_R.jpg"/>

<imgsrc="linkImages/search_Sel_L.jpg"/>

<imgsrc="linkImages/search_Sel_login_Over.jpg"/>

<imgsrc="linkImages/search_Sel_R.jpg"/></div>

<script>

//Set Default State

selTdId=document.getElementById("<%=hidSelectedTd.ClientID%>").value;

selTd=document.getElementById(selTdId);

selTd.className="linkSelected";

//left

if(selTdId=="td_10")//search

document.getElementById("td_9").style.backgroundImage="url(linkImages/search_Sel_L.jpg)";

elseif(selTdId=="td_12")//Login

document.getElementById("td_11").style.backgroundImage="url(linkImages/login_Sel_L.jpg)";

elseif(selTdId=="td_14")//Feedback

document.getElementById("td_13").style.backgroundImage="url(linkImages/feedback_Sel_L.jpg)";

else

document.getElementById("td_" + selTd.cellIndex.toString()).className="linkSelectedLeft";

//right

if(selTdId=="td_10")//search

document.getElementById("td_11").style.backgroundImage="url(linkImages/search_Sel_R.jpg)";

elseif(selTdId=="td_12")//Login

document.getElementById("td_13").style.backgroundImage="url(linkImages/linkSelected_R.jpg)";

elseif(selTdId=="td_14")//Feedback

document.getElementById("td_15").style.backgroundImage="url(linkImages/feedback_Sel_R.jpg)";

elseif(selTdId!="td_7")

document.getElementById("td_" + (selTd.cellIndex+2).toString()).className="linkSelectedRight";

else

document.getElementById("td_" + (selTd.cellIndex+2).toString()).className="linkFirstEndSelected";

</script>

</form>

</body>

</html>

====================================================================================================================

In Administrrative mode--

<%@dotnet.itags.org.PageLanguage="C#"AutoEventWireup="true"CodeFile="AddSettings.aspx.cs"Inherits="AddSettings" %>

<!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<htmlxmlns="http://www.w3.org/1999/xhtml">

<headrunat="server">

<title>AddSettings</title>

</head>

<bodytopmargin="0"leftmargin="0">

<formid="form1"runat="server">

<table>

<tr>

<tdstyle="width: 100px">

<tablewidth="100%">

<tr>

<tdstyle="width: 100px">

<imgsrc="images/banner_01.jpg"/></td>

<tdbgcolor="#ffd078"style="width: 6467%">

</td>

<tdstyle="width: 100px">

<imgsrc="images/banner_03.jpg"/></td>

</tr>

</table>

</td>

</tr>

<tr>

<tdstyle="width: 100px">

<table>

<tr>

<tdstyle="width: 100px"valign="top">

<tablewidth="100%">

<tr>

<tdid="controlPanel"align="center">

Control Panel</td>

</tr>

<tr>

<tdstyle="height: 157px">

<asp:MenuID="menu"runat="server"BackColor="#F7F6F3"CssClass="menu"DynamicHorizontalOffset="2"

EnableTheming="false"Font-Bold="True"Font-Names="Verdana"Font-Size="8pt"ForeColor="#7C6F57"

StaticSubMenuIndent="10px"Width="100%">

<StaticMenuItemStyleHorizontalPadding="5px"VerticalPadding="2px"/>

<DynamicHoverStyleBackColor="#7C6F57"ForeColor="White"/>

<DynamicMenuStyleBackColor="#F7F6F3"/>

<StaticSelectedStyleBackColor="#5D7B9D"/>

<DynamicSelectedStyleBackColor="#5D7B9D"/>

<DynamicMenuItemStyleHorizontalPadding="5px"VerticalPadding="2px"/>

<Items>

<asp:MenuItemNavigateUrl="Admin.aspx"Text="Home"Value="Home"></asp:MenuItem>

<asp:MenuItemNavigateUrl="Login1.aspx"Text="Login"Value="Login"></asp:MenuItem>

<asp:MenuItemNavigateUrl="SubcategoryTest.aspx"Text="Subcategory"Value="Subcategory">

</asp:MenuItem>

<asp:MenuItemNavigateUrl="CompanyList1.aspx"Text="Company"Value="Company">

</asp:MenuItem>

<asp:MenuItemNavigateUrl="FeedbackList.aspx"Text="Feedback"Value="Feedback">

</asp:MenuItem>

<asp:MenuItemNavigateUrl="Login1.aspx"Text="Chat"Value="Chat"></asp:MenuItem>

<asp:MenuItemNavigateUrl="AddSettings.aspx"Text="Advertisements"Value="Advertisements">

</asp:MenuItem>

<asp:MenuItemNavigateUrl="Password.aspx"Text="Security"Value="Security"></asp:MenuItem>

<asp:MenuItemNavigateUrl="Settings.aspx"Text="Settings"Value="Settings"></asp:MenuItem>

</Items>

<StaticHoverStyleBackColor="#7C6F57"ForeColor="White"/>

</asp:Menu>

</td>

</tr>

</table>

</td>

<tdstyle="width: 100px">

<tablewidth="100%">

<tr>

<td>

<asp:RadioButtonListID="rdPage"runat="server"RepeatColumns="2"AutoPostBack="True"

OnSelectedIndexChanged="rdPage_SelectedIndexChanged">

<asp:ListItemSelected="True">Home</asp:ListItem>

<asp:ListItem>General</asp:ListItem>

</asp:RadioButtonList>

</td>

<td>

<asp:DropDownListID="cmbSubcategory"runat="server"DataSourceID="odsSubcategory"

DataTextField="Name"DataValueField="ID"AutoPostBack="True"Visible="False"

OnSelectedIndexChanged="cmbSubcategory_SelectedIndexChanged">

</asp:DropDownList><asp:ObjectDataSourceID="odsSubcategory"runat="server"SelectMethod="SelectAll"

TypeName="SubCategory"></asp:ObjectDataSource>

</td>

</tr>

<tr>

<td>

Location :

</td>

<td>

<asp:DropDownListID="cmbLocation"runat="server"DataSourceID="odsLocation"DataTextField="Name"

DataValueField="Value"CssClass="cmb">

</asp:DropDownList><asp:ObjectDataSourceID="odsLocation"runat="server"SelectMethod="BindLocation"

TypeName="Advertisement"></asp:ObjectDataSource>

</td>

</tr>

<tr>

<td>

Image :

</td>

<td>

<asp:FileUploadID="fileImage"runat="server"/></td>

</tr>

<tr>

<td>

Width :

</td>

<td>

<asp:TextBoxID="txtWidth"runat="server"MaxLength="4"Width="56px"></asp:TextBox></td>

</tr>

<tr>

<td>

Height :

</td>

<td>

<asp:TextBoxID="txtHeight"runat="server"MaxLength="4"Width="56px"></asp:TextBox></td>

</tr>

<tr>

<td>

Link :

</td>

<td>

<asp:TextBoxID="txtLink"runat="server"MaxLength="100"></asp:TextBox></td>

</tr>

<tr>

<td>

Order :

</td>

<td>

<asp:TextBoxID="txtOrder"runat="server"MaxLength="2"Width="56px"></asp:TextBox></td>

</tr>

<tr>

<td>

</td>

<td>

<asp:ButtonID="btnAdd"runat="server"Text="Add"Width="59px"OnClick="btnAdd_Click"/></td>

</tr>

<tr>

<tdcolspan="2">

<asp:GridViewID="gvAdds"runat="server"AllowPaging="True"AutoGenerateColumns="False"

BackColor="White"BorderColor="#999999"BorderStyle="None"BorderWidth="1px"

CellPadding="3"GridLines="Vertical"DataSourceID="odsAdds"DataKeyNames="ID"OnRowUpdating="gvAdds_RowUpdating"OnRowDataBound="gvAdds_RowDataBound"OnRowEditing="gvAdds_RowEditing">

<Columns>

<asp:TemplateFieldHeaderText="Image"SortExpression="Image">

<EditItemTemplate>

<%#Advertisement.BindAdds((string)Eval("Image"),Eval("Width").ToString(),Eval("Height").ToString())%>

</EditItemTemplate>

<ItemTemplate>

<%#Advertisement.BindAdds((string)Eval("Image"),Eval("Width").ToString(),Eval("Height").ToString())%>

</ItemTemplate>

<ItemStyleWidth="100px"/>

</asp:TemplateField>

<asp:BoundFieldDataField="Width"HeaderText="Width"/>

<asp:BoundFieldDataField="Height"HeaderText="Height"/>

<asp:TemplateFieldHeaderText="Location"SortExpression="Location">

<EditItemTemplate>

<asp:DropDownListID="gvcmbLocation"runat="server"DataSourceID="odsLocation"DataTextField="Name"

DataValueField="Value"CssClass="cmb">

</asp:DropDownList>

</EditItemTemplate>

<ItemStyleWidth="75px"/>

<ItemTemplate>

<asp:LabelID="Label1"runat="server"Text='<%# Bind("Location") %>'></asp:Label>

</ItemTemplate>

</asp:TemplateField>

<asp:BoundFieldDataField="Link"HeaderText="Link"SortExpression="Link">

<ItemStyleWidth="150px"/>

</asp:BoundField>

<asp:BoundFieldDataField="Order"HeaderText="Order"SortExpression="Order">

<ItemStyleWidth="25px"/>

</asp:BoundField>

<asp:TemplateFieldShowHeader="False">

<ItemTemplate>

<asp:LinkButtonID="LinkButton1"runat="server"CausesValidation="False"CommandName="Edit"

Text="Edit"></asp:LinkButton>

<asp:LinkButtonID="lnkDelete"runat="server"CausesValidation="False"CommandName="Delete"

Text="Delete"></asp:LinkButton>

</ItemTemplate>

<ItemStyleWidth="75px"/>

<EditItemTemplate>

<asp:LinkButtonID="lnkUpdate"runat="server"CausesValidation="False"CommandName="Update"

Text="Update"></asp:LinkButton>

<asp:LinkButtonID="LinkButton2"runat="server"CausesValidation="False"CommandName="Cancel"

Text="Cancel"></asp:LinkButton>

</EditItemTemplate>

</asp:TemplateField>

</Columns>

<FooterStyleBackColor="#CCCCCC"ForeColor="Black"/>

<RowStyleBackColor="#EEEEEE"ForeColor="Black"/>

<SelectedRowStyleBackColor="#008A8C"Font-Bold="True"ForeColor="White"/>

<PagerStyleBackColor="#999999"ForeColor="Black"HorizontalAlign="Center"/>

<HeaderStyleBackColor="#000084"Font-Bold="True"ForeColor="White"/>

<AlternatingRowStyleBackColor="Gainsboro"/>

</asp:GridView>

<asp:ObjectDataSourceID="odsAdds"runat="server"OnSelecting="odsAdds_Selecting"

SelectMethod="SelectAll"TypeName="Advertisement"DataObjectTypeName="Advertisement"

DeleteMethod="Delete"UpdateMethod="Update"OnUpdating="odsAdds_Updating">

<SelectParameters>

<asp:ControlParameterControlID="cmbSubcategory"DefaultValue="0"Name="subDirectoryID"

PropertyName="SelectedValue"Type="Int32"/>

</SelectParameters>

</asp:ObjectDataSource>

</td>

</tr>

<tr>

<td>

</td>

<td>

</td>

</tr>

</table>

</td>

</tr>

</table>

</td>

</tr>

<tr>

<tdstyle="width: 100px">

2007 Info Prism Solutions . All rights reserved. <br/>

<spanstyle="font-size: 8pt"> Centre Point, M G Road, Thrissur - 4 0487

- 2387546, 6543322 visit us -<ahref="http://www.infoprismsolution.com"target="_blank">

infoprismsolution.com</a> </span></td>

</tr>

</table>

</form>

</body>

</html>

=================================================================

using System;

using System.Data;

using System.Configuration;

using System.Collections;

using System.Web;

using System.Web.Security;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Web.UI.WebControls.WebParts;

using System.Web.UI.HtmlControls;

publicpartialclassAddSettings : System.Web.UI.Page

{

#region Fields

Advertisement add =null;

Location loc;

publicstring selLoc;

#endregion

#region Methods

privatevoid UploadFile(string id)

{

string ext = System.IO.Path.GetExtension(fileImage.PostedFile.FileName);

string path = Server.MapPath("Adds") +"\\" +"Add_" + id + ext;

fileImage.PostedFile.SaveAs(path);

}

publicstring GetSize(string file)

{

string size ="";

System.Drawing.Image img =new System.Drawing.Bitmap(Server.MapPath("Directoryweb")+"\\Adds\\" + file);

size ="Width=" + (img.Width > 100 ? 100 : img.Width).ToString();

size +="Height=" + (img.Height > 100 ? 100 : img.Height).ToString();

return size;

}

#endregion

#region Event Handlers

protectedvoid Page_Load(object sender,EventArgs e)

{

//Client.CheckAuthorisation(Roles.Admin);

}

protectedvoid btnAdd_Click(object sender,EventArgs e)

{

if (btnAdd.Text =="Add")

{

add =newAdvertisement();

add.Image = System.IO.Path.GetExtension(fileImage.PostedFile.FileName);

add.Width =Utilities.ToInt(txtWidth.Text.Trim());

add.Height =Utilities.ToInt(txtHeight.Text.Trim());

add.Link = txtLink.Text;

add.Location = (Location)cmbLocation.SelectedValue[0];

add.Order =Utilities.ToInt(txtOrder.Text);

//==== add.Subcategory = rdPage.SelectedValue == "Home" ? null : SubCategory.Select(Utilities.ToInt(cmbSubcategory.SelectedValue));

Advertisement.Insert(add);

UploadFile(add.ID.ToString());

}

gvAdds.DataBind();

}

protectedvoid rdPage_SelectedIndexChanged(object sender,EventArgs e)

{

if (rdPage.SelectedValue =="General")

cmbSubcategory.Visible =true;

else

cmbSubcategory.Visible =false;

gvAdds.DataBind();

}

protectedvoid cmbSubcategory_SelectedIndexChanged(object sender,EventArgs e)

{

gvAdds.DataBind();

}

protectedvoid gvAdds_RowUpdating(object sender,GridViewUpdateEventArgs e)

{

//save Location for update

loc = (Location)((DropDownList)gvAdds.Rows[e.RowIndex].FindControl("gvcmbLocation")).SelectedValue[0];

}

protectedvoid odsAdds_Selecting(object sender,ObjectDataSourceSelectingEventArgs e)

{

if (rdPage.SelectedValue =="Home")

e.InputParameters["subDirectoryID"] ="0";

else

{

string selValue = cmbSubcategory.SelectedValue ==null ?"" : cmbSubcategory.SelectedValue;

cmbSubcategory.DataBind();

if (selValue !="")

cmbSubcategory.SelectedValue = selValue;

e.InputParameters["subDirectoryID"] = cmbSubcategory.SelectedValue;

}

}

protectedvoid odsAdds_Updating(object sender,ObjectDataSourceMethodEventArgs e)

{

((Advertisement)e.InputParameters[0]).Location = loc;

}

protectedvoid gvAdds_RowDataBound(object sender,GridViewRowEventArgs e)

{

DropDownList cmbEditLocation;

if (gvAdds.EditIndex == e.Row.RowIndex && e.Row.RowIndex != -1)

{

cmbEditLocation = (DropDownList)e.Row.FindControl("gvcmbLocation");

if (cmbEditLocation !=null && cmbEditLocation.Items.Count > 0)

cmbEditLocation.SelectedValue = selLoc[0].ToString();

}

}

protectedvoid gvAdds_RowEditing(object sender,GridViewEditEventArgs e)

{

selLoc = ((System.Web.UI.WebControls.Label)gvAdds.Rows[e.NewEditIndex].Cells[3].Controls[1]).Text;

}

#endregion

}


Thank you guys very much. I am going to start working on it tonight! I will update you with what happen :)

I appreciate your input

Thursday, March 22, 2012

The graphics?

Hi,

Not sure if this is the right area to post.

Can anyone point me to some resources about the graphics side of web dev?

I mean, I see the programming part and I can see the design part (like in photoshop?), but how would you take something from photoshop and use it in Visual studio and have it all line up?

I have seen it done in tables and with css...but is that all there is? How do you split up the graphics and how do you know how big to make them? I realize this isn't a coding question, but I am having some trouble bridging the gap.

I hope I am being somewhat clear in my question.

Thanks!

As far as actual layout goes CSS seems to be the standard right now. I know that some people prefer tables, and they work fine sometimes, but I've had issues in the past with a table site when things need to be moved around, so I use CSS now whenever possible.

As far as the size of the graphics (I'm assuming you mean file size) you want to make them as small as possible. The smaller your graphics are, the faster your page will load, and the happier your users will be.

If you want a good book to get started with I like this one:http://www.headfirstlabs.com/books/hfhtml/index.php I've recommended it to people in the past and I've never heard anything bad about it from the people I've recommended it to.


I'll check out that book, thanks...

but I did mean the actual size of the graphics (length/width)...

see...I think I am having trouble connecting the two.

I want to create pages using asp.net. And if I create just web forms etc...I have no problem, seems easy.

but I want to create something with more color and definition or maybe a nice big banner with a menu. I don't know how to create those graphics and then use them in ASP.NET. How do I separate them? I have seen slicing (not sure how to do it yet), but then how to I get them all back together in my asp.net page?

Is that all done with css? Is that what you are saying? Just wanted to make sure.

Thanks again!


A similar post in the pasthttp://forums.asp.net/p/1174532/1975337.aspx

Cheers

Vishal Khanna

(pls mark as answer if reply helps)