Stephen Forero
asked on
listbox selections not being set as true
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
if (FileUpload1.HasFile)
{
try
{
string uploadfilename = Path.GetFileName(FileUpload1.FileName);
FileUpload1.SaveAs(Server.MapPath("UserUploads/") + uploadfilename);
StatusLabel.Text = "Upload status: File uploaded!";
PopulateManagerList();
File.Delete(Server.MapPath("UserUploads/Comma.csv"));
}
catch (Exception ex)
{
StatusLabel.Text = "Upload status: The file could not be uploaded.";
}
}
}
protected void PopulateManagerList()
{
char separator = ',';
StreamReader sr = new StreamReader(Server.MapPath("UserUploads/comma.csv"));
string line;
List<string> rows = new List<string>();
while ((line = sr.ReadLine()) != null)
{
rows.Add(line);
line = sr.ReadLine();
}
List<string[]> rowObjects = new List<string[]>();
int maxColsCount = 0;
foreach (string s in rows)
{
string[] convertedRow = s.Split(new char[] { separator });
if (convertedRow.Length > maxColsCount)
maxColsCount = convertedRow.Length;
rowObjects.Add(convertedRow);
}
table = new DataTable("myNewTable");
for (int i = 0; i < maxColsCount; i++)
{
table.Columns.Add(new DataColumn());
}
foreach (string[] rowArray in rowObjects)
{
table.Rows.Add(rowArray);
}
table.AcceptChanges();
GridView1.DataSource = table;
GridView1.DataBind();
//Load names into Listbox from 1st row in datatable
foreach (string itemz in table.Rows[0].ItemArray)
{
ListBox1.Items.Add(itemz);
}
ListBox1.Items.RemoveAt(0);
table.WriteXml(Server.MapPath("UserUploads/comma.xml"));
//table.WriteXml(memStm);
//memStm.Seek(0, System.IO.SeekOrigin.Begin);
sr.Close();
// string results = Request.Form[ListBox1.UniqueID];
}
protected void BeginProcess()
{
DataSet dataSet = new DataSet();
DataTable table2;
//memStm.Seek(0, System.IO.SeekOrigin.Begin);
//dataSet.ReadXml(memStm);
dataSet.ReadXml(Server.MapPath("UserUploads/comma.xml"));
GridView2.DataSource = dataSet;
GridView2.DataBind();
//File.Delete(Server.MapPath("UserUploads/Comma.xml"));
table2 = dataSet.Tables[0];
GridView3.DataSource = dataSet;
GridView3.DataBind();
//go through listbox1 to find selected managers = selectedManagersList
List<string> selectedManagersList = new List<string>();
foreach (ListItem strItem in ListBox1.Items)
{
if (strItem.Selected)
{
selectedManagersList.Add(strItem.Value);
}
}
// go through each column and find selected managers... return column number
int test1;
List<int> managerColumn = new List<int>();
string managerName;
foreach (string item1 in selectedManagersList)
{
managerName = item1;
foreach (string item2 in table2.Rows[0].ItemArray)
{
if (item2 == managerName)
{
string counter = table2.Rows[0].ItemArray.ToString();
}
}
}
string manager = "Ssaris Div";
foreach (DataColumn myCol in table2.Columns)
{
string temp = table2.Rows[0][myCol].ToString();
if (temp == manager)
{
int tempcounter = myCol.Ordinal;
}
}
}
Hi guys,I have a asp.net webpage,
When user uploads csv file, I read it in xml and populate listbox.
When I select multiple choices for listbox, and when I hit RUN BUTTON(this is BEGIN PROCESS method)... the items I selected are not being registered as selected. I think it has something to do with postback but I do not fully understands the concept.
any idea why its not being selected as true?
just to give more details... on page load nothing happens. User selects file to upload... when the user hits button to upload, listbox is populated. Then I want user to select multiple items from listbox, and "do something" with the selected choices. Problem is selections are not being marked as true.
ASKER
In the listbox1 properties window I have selectionmode = multiple
viewstatemode=enabled enableviewstate=true
<asp:ListBox ID="ListBox1" runat="server" CssClass="style1" Height="413px"
Width="281px" Float="right" SelectionMode="Multiple"
ViewStateMode="Enabled"></ asp:ListBo x>
What does dynamic or static mean?
viewstatemode=enabled enableviewstate=true
<asp:ListBox ID="ListBox1" runat="server" CssClass="style1" Height="413px"
Width="281px" Float="right" SelectionMode="Multiple"
ViewStateMode="Enabled"></
What does dynamic or static mean?
Dynamic means added in code, static means defined in HTML--so you have a static control.
I see that you are not binding the ListBox to anything, so how are values added? How is the ListBox control part of the "bigger picture"?
I see that you are not binding the ListBox to anything, so how are values added? How is the ListBox control part of the "bigger picture"?
ASKER
ok , so yes it is added in HTML, so its static. Thanks for the explanation.
On PAGELOAD nothing happens.
in regards to listbox population...
user hits BUTTON "Button1_Click"
which uploads ands saves csv to server folder. then calls "PopulateManagerList" which creates datatable. Then loads LISTBOX1 with data from reading the datatable. Then writes xml to server.
(all this works correctly)
then user hits "Button2_Click"
this is the part where it reads the selected items from user.... but NONE are being marked as selected
On PAGELOAD nothing happens.
in regards to listbox population...
user hits BUTTON "Button1_Click"
which uploads ands saves csv to server folder. then calls "PopulateManagerList" which creates datatable. Then loads LISTBOX1 with data from reading the datatable. Then writes xml to server.
(all this works correctly)
then user hits "Button2_Click"
this is the part where it reads the selected items from user.... but NONE are being marked as selected
protected void Button1_Click(object sender, EventArgs e)
{
if (FileUpload1.HasFile)
{
try
{
string uploadfilename = Path.GetFileName(FileUpload1.FileName);
FileUpload1.SaveAs(Server.MapPath("UserUploads/") + uploadfilename);
StatusLabel.Text = "Upload status: File uploaded!";
PopulateManagerList();
//FileUpload1.FileContent.Dispose();
//File.Delete(Server.MapPath("UserUploads/Comma.csv"));
}
catch (Exception ex)
{
StatusLabel.Text = "Upload status: The file could not be uploaded.";
}
}
}
protected void PopulateManagerList()
{
char separator = ',';
StreamReader sr = new StreamReader(Server.MapPath("UserUploads/comma.csv"));
string line;
List<string> rows = new List<string>();
while ((line = sr.ReadLine()) != null)
{
rows.Add(line);
line = sr.ReadLine();
}
List<string[]> rowObjects = new List<string[]>();
int maxColsCount = 0;
foreach (string s in rows)
{
string[] convertedRow = s.Split(new char[] { separator });
if (convertedRow.Length > maxColsCount)
maxColsCount = convertedRow.Length;
rowObjects.Add(convertedRow);
}
table = new DataTable("myNewTable");
for (int i = 0; i < maxColsCount; i++)
{
table.Columns.Add(new DataColumn());
}
foreach (string[] rowArray in rowObjects)
{
table.Rows.Add(rowArray);
}
table.AcceptChanges();
GridView1.DataSource = table;
GridView1.DataBind();
//Load names into Listbox from 1st row in datatable
foreach (string itemz in table.Rows[0].ItemArray)
{
ListBox1.Items.Add(itemz);
}
ListBox1.Items.RemoveAt(0);
table.WriteXml(Server.MapPath("UserUploads/comma.xml"));
sr.Close();
}
protected void Button2_Click(object sender, EventArgs e)
{
DataSet dataSet = new DataSet();
DataTable table2;
//memStm.Seek(0, System.IO.SeekOrigin.Begin);
//dataSet.ReadXml(memStm);
dataSet.ReadXml(Server.MapPath("UserUploads/comma.xml"));
GridView2.DataSource = dataSet;
GridView2.DataBind();
//File.Delete(Server.MapPath("UserUploads/Comma.xml"));
table2 = dataSet.Tables[0];
GridView3.DataSource = dataSet;
GridView3.DataBind();
//go through listbox1 to find selected managers = selectedManagersList
List<string> selectedManagersList = new List<string>();
foreach (ListItem strItem in ListBox1.Items)
{
if (strItem.Selected)
{
selectedManagersList.Add(strItem.Value);
}
}
// go through each column and find selected managers... return column number
int test1;
List<int> managerColumn = new List<int>();
string managerName;
foreach (string item1 in selectedManagersList)
{
managerName = item1;
foreach (string item2 in table2.Rows[0].ItemArray)
{
if (item2 == managerName)
{
string counter = table2.Rows[0].ItemArray.ToString();
}
}
}
string manager = "Ssaris Div";
foreach (DataColumn myCol in table2.Columns)
{
string temp = table2.Rows[0][myCol].ToString();
if (temp == manager)
{
int tempcounter = myCol.Ordinal;
}
}
}
If you are "dynamically" adding items to a ListBox, in code:
does the ListBox have any items when the page posts back?
foreach (string itemz in table.Rows[0].ItemArray)
{
ListBox1.Items.Add(itemz);
}
does the ListBox have any items when the page posts back?
ASKER
When I hit that second button and the page reloads... my listbox is still populated.. but my highlighted selections are cleared away.
This might be a good time to debug the view state.
ASP.NET ViewState Helper (Fiddler)
http://www.binaryfortress.com/ASPNET-ViewState-Helper-Fiddler/
ASP.NET ViewState Helper (Fiddler)
http://www.binaryfortress.com/ASPNET-ViewState-Helper-Fiddler/
ASKER
I'll take a look at it. So I'm guessing you do not see anything wrong?
If I have viewstate enabled AND I do not repopulate the listbox when page reloads... it should save my selections correct?
If I have viewstate enabled AND I do not repopulate the listbox when page reloads... it should save my selections correct?
I usually try to test any assumptions that I have in a "sandbox". Create a small, temporary web application, and try that simple experiment, without any other distractions.
That is what I would have to do to verify, as web development can be a tricky beast to work with, and keep everything straight.
Remember, that I can't see everything that you can. I only have a narrow view of what you are working with.
That is what I would have to do to verify, as web development can be a tricky beast to work with, and keep everything straight.
Remember, that I can't see everything that you can. I only have a narrow view of what you are working with.
ASKER
ugh, this is a nightmare. So I will take your suggestion and just try a new application, hopefully it will help me dwindle down the problem area.
A lot of problems with ASP.NET require an in-depth knowledge of the page life-cycle. Have you seen anything on that?
Like this:
http://i.msdn.microsoft.com/dynimg/IC386473.png
Like this:
http://i.msdn.microsoft.com/dynimg/IC386473.png
ASKER
so I've isolated the problem and I'm hoping you can help me figure it out. I started this project by downloading a template. In this particular page I'm using the page has 2 columns in the content area. This listbox that is NOT working is in the right side column. Now if I add a listbox to the left column it works like it should. When I add a new listbox to the right column, it does NOT work. There must be some kind of setting on the RIGHT COLUMN AREA that does not let this work. Am I making any sense?
I also noticed even if I put a regular button on the RIGHT (NOT WORKING) side... and user clicks on button... nothing happens at all, like the event is not firing. theres got to be something with this?!?
I also noticed even if I put a regular button on the RIGHT (NOT WORKING) side... and user clicks on button... nothing happens at all, like the event is not firing. theres got to be something with this?!?
I would need to see what you are working with, as there are too many possibilities that I can't guess...
1) Relevant HTML -- no dumps please
2) Relevant CSS rules, if used.
1) Relevant HTML -- no dumps please
2) Relevant CSS rules, if used.
ASKER
sure, so I don't bombard you with information. How do I know whichi HTML to send. I'll attach my style.css.
style.txt
style.txt
How much HTML are you working with? I would think that we could start by attaching a screen shot of the document outline.
Example:
Snapshot.png
Example:
Snapshot.png
ASKER
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="site.master.cs" Inherits="site" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>TemplateAccess.com Theme</title>
<meta http-equiv="X-UA-Compatible" content="IE=7" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link href="style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/jquery-1.3.2.min.js"></script>
<!-- Custom -->
<script type="text/javascript">
$(function () { $('.search span').css({ 'border-radius': '5px' }); });
</script>
<!-- Cufon -->
<script type="text/javascript" src="js/cufon-yui.js"></script>
<script type="text/javascript" src="js/myradpro.font.js"></script>
<script type="text/javascript">
Cufon.replace('h1')('h2')('h3')('h4')('.menu a')('.rss a.big');
</script>
<!-- flash script -->
<script type="text/javascript" src="js/flash_detect.v1.7.js"></script>
<asp:ContentPlaceHolder id="head" runat="server">
</asp:ContentPlaceHolder>
<style type="text/css">
.style1
{
width: 51px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div class="main">
<div class="top_line">
<div class="menu">
<ul>
<li><a href="Default.aspx" class="active"><span>Home</span></a></li>
<li><a href="Introduction.aspx"><span>Product</span></a></li>
<li><a href="Instruction.aspx"><span>User Guide</span></a></li>
<li><a href="Suggestions.aspx"><span>Customize</span></a></li>
<li><a href="Register.aspx"><span>Sign Up</span></a></li>
<%-- <% if (Request.IsAuthenticated) { %>--%>
<li><a href="Userform.aspx" class="publicview"><span>Userform</span></a></li>
<%-- <%}%>--%>
</ul>
<div class="clr"></div>
</div>
<%-- <form id="form2" name="form1" method="post" action="">
<span>
</span>
</form>--%>
<div class ="LOGINAREA" style="float: right; width: 500px;">
<asp:Login ID="Login1" runat="server" Orientation="Horizontal"
DestinationPageUrl="~/Default.aspx" VisibleWhenLoggedIn="False" >
<LayoutTemplate>
<table cellpadding="1" cellspacing="0" style="border-collapse:collapse; ">
<tr>
<td>
<table cellpadding="0">
<tr>
<td align="center" colspan="6">
Log In</td>
</tr>
<tr>
<td>
<asp:Label ID="UserNameLabel" runat="server" AssociatedControlID="UserName">User
Name:</asp:Label>
</td>
<td>
<asp:TextBox ID="UserName" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="UserNameRequired" runat="server"
ControlToValidate="UserName" ErrorMessage="User Name is required."
ToolTip="User Name is required." ValidationGroup="ctl00$Login1">*</asp:RequiredFieldValidator>
</td>
<td>
<asp:Label ID="PasswordLabel" runat="server" AssociatedControlID="Password">Password:</asp:Label>
</td>
<td>
<asp:TextBox ID="Password" runat="server" TextMode="Password"></asp:TextBox>
<asp:RequiredFieldValidator ID="PasswordRequired" runat="server"
ControlToValidate="Password" ErrorMessage="Password is required."
ToolTip="Password is required." ValidationGroup="ctl00$Login1">*</asp:RequiredFieldValidator>
</td>
<td>
</td>
<td class="style1">
<asp:Button ID="LoginButton" runat="server" CommandName="Login" Text="Log In"
ValidationGroup="ctl00$Login1" />
</td>
</tr>
<tr>
<td colspan="6" style="color:Red;">
<asp:Literal ID="FailureText" runat="server" EnableViewState="False"></asp:Literal>
</td>
</tr>
</table>
</td>
</tr>
</table>
</LayoutTemplate>
</asp:Login>
</div>
<div class="clr" style="float: right"></div>
</div>
<asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server">
<div class="header">
<div class="logo">
<a href="#">
<img src="images/logo.png" alt="logo" width="215" height="109" border="0" /></a></div>
<div class="rss">
<a href="#" class="big" title="Subscribe To Our Posts RSS Feed" target="_blank">Subscribe to our
<span>RSS</span></a>
<ul>
<li class="first">
<a href="#" title="Subscribe To Our Posts RSS Feed" target="_blank">Posts</a></li>
<li><a href="#" title="Subscribe To Our Comments RSS Feed" target="_blank">Comments</a></li>
<li><a href="#" title="Subscribe To Receive Email Updates" target="_blank">E-mail</a></li>
</ul>
</div>
<div class="clr">
</div>
<div id="slider">
<!-- start slideshow -->
<div class="flash_slider">
<script language="JavaScript" type="text/javascript">
AC_FL_RunContent(
'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0',
'width', '100%',
'height', '450',
'src', 'piecemakerNoShadow',
'quality', 'high',
'pluginspage', 'http://www.adobe.com/go/getflashplayer',
'align', 'middle',
'play', 'true',
'loop', 'true',
'scale', 'noscale',
'wmode', 'transparent',
'devicefont', 'false',
'id', 'piecemakerNoShadow',
'bgcolor', '#f4f4f4',
'name', 'piecemakerNoShadow',
'menu', 'true',
'allowFullScreen', 'false',
'allowScriptAccess', 'sameDomain',
'movie', 'piecemakerNoShadow',
'salign', ''
); //end AC code
</script>
</div>
<!-- end #slideshow -->
<div class="clr">
</div>
</div>
</div>
<div class="bg_top">
</div>
<div class="header_text">
<h1>
AldHere we gooooooisque non ante id eros a ccumsan iaculis quis a velit. Donec quam pur
<span>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</span></h1>
</div>
<div class="bg_center">
</div>
<div class="body">
<div class="port">
<h2>
What We Do <span>Sed congue, dui vel tristique mollis...</span></h2>
<img src="images/img_1.jpg" alt="picture" width="288" height="95" class="none" />
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi id tristique sem. Nuncnec ipsum sed nisi dictum mollis. Praesent malesuada mauris a odio adipiscing mollis. Invarius tincidunt elit vitae eleifend.
</p>
<p>
<a href="#">
<img src="images/button_more.gif" alt="button" width="55" height="28" border="0" class="none" /></a></p>
</div>
<div class="port">
<h2>
Business Monitoring <span>Sed congue, dui vel tristique mollis...</span></h2>
<img src="images/img_2.jpg" alt="picture" width="288" height="95" class="none" />
<p>
Sed tempus bibendum risus, nec dignissim sem vestibulum ut. Nam iaculis aliquam elementum. Nunc sed dignissim sapien.
</p>
<p>
<a href="#">
<img src="images/button_more.gif" alt="button" width="55" height="28" border="0" class="none" /></a></p>
</div>
<div class="port last">
<h2>
Easy to Customize <span>Sed congue, dui vel tristique mollis...</span></h2>
<img src="images/img_3.jpg" alt="picture" width="288" height="95" class="none" />
<p>
Aenean at lectus eget neque consequat sagittis ut sed nisl.
<br />Nulla facilisi. Aenean a lect massa. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae</p>
<p>
<a href="#">
<img src="images/button_more.gif" alt="button" width="55" height="28" border="0" class="none" /></a></p>
</div>
<div class="clr">
</div>
</div>
<div class="bg_center">
</div>
</asp:ContentPlaceHolder>
<div class="FBG">
<div class="FBG_resize">
<div class="blog">
<h2>Recent Post</h2>
<ul>
<li><a href="#">» Full standards compliance</a></li>
<li><a href="#">» All of Videos Supported</a></li>
<li><a href="#">» Spam protection</a></li>
<li><a href="#">» Video Support!</a></li>
<li><a href="#">» We have gone!</a></li>
<li><a href="#">» Dummy Photo</a></li>
<li><a href="#">» We have gone!</a></li>
<li><a href="#">» Dummy Photo</a></li>
<li><a href="#">» Spam protection</a></li>
</ul>
</div>
<div class="blog">
<h2>Miscelaneous</h2>
<ul>
<li><a href="#">Site Admin</a></li>
<li><a href="#"> Log out</a></li>
<li><a href="#"> Entries RSS</a></li>
<li><a href="#"> Comments RSS</a></li>
<li><a href="#">Site Admin</a></li>
<li><a href="#"> Log out</a></li>
<li><a href="#"> Entries RSS</a></li>
<li><a href="#"> Comments RSS</a></li>
<li><a href="#"> WordPress.org</a><br />
</li>
</ul>
</div>
<div class="blog">
<h2>Latest News</h2>
<p><strong>At vero eos et accusamus et iusto </strong><br />
<a href="#">January 6, 2010</a><br />
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor dolore magna aliqua...</p>
<p><strong>Cras lobortis mauris vel diam </strong><br />
<a href="#">February 27, 2010</a><br />
Ut enim ad minim veniam, quis nostrud exercitation Lorem ipsum dolor sit amet...</p>
<div class="clr"></div>
</div>
<div class="blog last">
<h2>Contact</h2>
<p>+1 215.676.7876<br />
<a href="mailto:contact@mycompany.com">contact@mycompany.com</a><br />
123 Pine Street<br />
Mycity, ST 19000 </p>
</div>
<div class="clr"></div>
</div>
</div>
<div class="footer">
<div class="footer_resize">
<p class="leftt">© Copyright <a href="#">Templatesold</a>. All Rights Reserved </p>
<p class="right"> (TS) <a href="http://www.templatesold.com">Website Templates</a></p>
<div class="clr"></div>
</div>
</div>
</div>
</form>
</body>
</html>
I have a master page... for the layout of the website. with Contentplaceholder1... holding contents of all underlying pages.Then in the page that I am working called "Userform.aspx"
the code snippet I attached is the masterpage.
ASKER
<%@ Page Title="" Language="C#" MasterPageFile="~/site.master" AutoEventWireup="true" CodeFile="Userform.aspx.cs" Inherits="Default2" %>
<%@ Register assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" namespace="System.Web.UI.DataVisualization.Charting" tagprefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
<style type="text/css">
.style1
{}
</style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<div class="header">
<div class="logo"><a href="#"><img src="images/logo.png" alt="logo" width="215" height="109" border="0" /></a></div>
<div class="rssAREA" style="color: #FF0000">
<asp:LoginView ID="LoginView1" runat="server">
<LoggedInTemplate>
Welcome
<asp:LoginName ID="LoginName1" runat="server" />
</LoggedInTemplate>
</asp:LoginView>
</div>
<div class="clr"></div>
</div>
<div class="bg_top"></div>
<div class="header_text">
<h1>Userform<span>Fill in relevant information on this page.</span></h1>
</div>
<div class="bg_center"></div>
<div class="body">
<div class="left">
<h2>Send a Message<span>Sed congue, dui vel tristique mollis...</span></h2>
<p>Step1. Upload your datafile.</p>
<p><asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Upload Datafile" /></p>
<p>
<asp:ListBox ID="ListBox5" runat="server" SelectionMode="Multiple">
<asp:ListItem>aaa</asp:ListItem>
<asp:ListItem>bbb</asp:ListItem>
<asp:ListItem>three</asp:ListItem>
</asp:ListBox>
</p>
<p>
<asp:ListBox ID="ListBox6" runat="server" SelectionMode="Multiple">
<asp:ListItem Value="new1"></asp:ListItem>
<asp:ListItem Value="new2"></asp:ListItem>
<asp:ListItem Value="new3"></asp:ListItem>
</asp:ListBox>
</p>
<p>Ut id mi sed lacus pulvinar luctus eu vitae enim. Phasellus placerat ipsum nec leo porta accumsan. Aliquam dui ante, sagittis ultrices venenatis id, scelerisque consequat lacus. Etiam vehicula, libero non ultricies volutpat, quam lacus consectetur massa, in tempus orci lorem sit amet nisl. Praesent mollis ultrices lacus non tempor. Curabitur congue, nulla non consequat rutrum, tellus tortor aliquet massa, eu tincidunt sem velit ac leo. In rhoncus diam eget nunc lobortis eget interdum augue euismod. </p>
<p>
<asp:FileUpload ID="FileUpload1" runat="server" />
</p>
<p>
<asp:Label ID="StatusLabel" runat="server" Text="Upload Status: "></asp:Label>
</p>
<p>
Proin tempus pulvinar nunc et pulvinar. Maecenas vel sem sit amet mauris porttitor suscipit non id neque. Ut vehicula dui at ante ultricies ac bibendum erat tempus. Mauris sagittis est sed orci pulvinar a lobortis orci lobortis. Aenean non velit sit amet nulla laoreet gravida.</p>
<p>
<asp:Button ID="Button2" runat="server" onclick="Button2_Click"
Text="Load Data" />
</p>
<p>
<asp:Button ID="Button3" runat="server" onclick="Button3_Click" Text="Button" />
</p>
<script type="text/C#" language ="javascript">
var xlApp = new ActiveXObject("Excel.Application");
xlApp.Visible = true;
</script>
<h2>Contact Form<span>Sed congue, dui vel tristique mollis...</span></h2>
<form action="contact.php" method="post" id="contactform">
<ol>
<li>
<label for="name">First Name:</label>
<input id="name" name="name" class="text" />
</li>
<li>
<label for="email">Your email:</label>
<input id="email" name="email" class="text" />
</li>
<li>
<label for="company">Company:</label>
<input id="company" name="company" class="text" />
</li>
<li>
<label for="message">Message:</label>
<textarea id="message" name="message" rows="6" cols="50"></textarea>
</li>
<li class="buttons">
<input type="image" name="imageField" id="imageField" src="images/button_more.gif" class="send" />
<div class="clr"></div>
</li>
<p>
<asp:GridView ID="GridView1" runat="server">
</asp:GridView>
</p>
<p>
<asp:GridView ID="GridView2" runat="server">
</asp:GridView>
</p>
<p>
<asp:GridView ID="GridView3" runat="server">
</asp:GridView>
</p>
<p>
<asp:ListBox ID="ListBox2" runat="server" SelectionMode="Multiple"
Width="131px">
<asp:ListItem Value="one"></asp:ListItem>
<asp:ListItem Value="two"></asp:ListItem>
<asp:ListItem Value="three"></asp:ListItem>
<asp:ListItem Value="four"></asp:ListItem>
<asp:ListItem Value="five"></asp:ListItem>
</asp:ListBox>
</p>
</ol>
</form>
</div>
<div class="right">
<h2>Get in touch<span>Sed congue, dui vel tristique mollis...</span></h2>
<p><strong>Address Info</strong><br />
123 Pine Street<br />
Mycity, ST 19000</p>
<p>
<asp:ListBox ID="ListBox4" runat="server" SelectionMode="Multiple"
ViewStateMode="Enabled">
<asp:ListItem>one</asp:ListItem>
<asp:ListItem Value="two"></asp:ListItem>
<asp:ListItem Value="three"></asp:ListItem>
</asp:ListBox>
</p>
<p><strong>Email:</strong><a href="mailto:contact@mycompany.com"> contact@mycompany.com</a><br />
<strong>Website:</strong> <a href="#">www.mycompany.com</a><br />
<strong>Phone:</strong> 0800-123456 </p>
<p>
<asp:Label ID="Label2" runat="server" Font-Bold="True" ForeColor="Black"
Text="Manager Selection:"></asp:Label>
</p>
<p>
<asp:ListBox ID="ListBox3" runat="server" SelectionMode="Multiple">
<asp:ListItem Value="one"></asp:ListItem>
<asp:ListItem Value="two"></asp:ListItem>
<asp:ListItem>three</asp:ListItem>
</asp:ListBox>
</p>
<p>
<asp:ListBox ID="ListBox1" runat="server" CssClass="style1" Height="413px"
Width="281px" Float="right"
onselectedindexchanged="ListBox1_SelectedIndexChanged"
SelectionMode="Multiple">
<asp:ListItem Value="briarwood"></asp:ListItem>
<asp:ListItem>ssaris</asp:ListItem>
<asp:ListItem>div</asp:ListItem>
<asp:ListItem Value="tester"></asp:ListItem>
</asp:ListBox>
</p>
</div>
<div class="clr"></div>
</div>
<div class="bg_center"></div>
</asp:Content>
and this one is the page in question... userform.aspxI apologize that I do not have the knowledge of what part to cut out to make it easier to read. As yiou can tell I'm very new to this
HTML is not an easy read...what is the "bigger picture"?
Example:
<div>
<div>
<table>
<tr>
<td>
The Document Outline dialog that I showed in the attached screen shot can provide that information without all the other detail.
Example:
<div>
<div>
<table>
<tr>
<td>
The Document Outline dialog that I showed in the attached screen shot can provide that information without all the other detail.
ASKER
how do I get just that information to display?
There is a menu option: View > Other Windows > Document Outline. It displays the task window in the IDE, which I attached as an example screenshot.
ASKER
That is a much better overview, as I can see that there are 2 ContentPlaceHolders, from what looks like a master page. I assume that you are talking about Content2, which would be rendered as a <div> on the right side of the page.
ASKER
actually, I downloaded this template. So I'm not even sure why there is 2 contentplaceholders. I believe I am only using 1 of them... which is ID=Content2
In content2, one of the div holders is labeled=body. In the body there is 2 columns, left and right. That is the section in question, left works, right does not.
In content2, one of the div holders is labeled=body. In the body there is 2 columns, left and right. That is the section in question, left works, right does not.
Ok, so we are narrowing down the search to something closer...
left = <div class="left">
right = <div class="right">
If that is a correct identification, can you show me the CSS class rules for "left" and "right", please?
left = <div class="left">
right = <div class="right">
If that is a correct identification, can you show me the CSS class rules for "left" and "right", please?
ASKER
they are both in the div.body
the left css is
the right css is
body { margin:0; padding:0; width:100%; background:#f4f4f4;}
.body { width:910px; margin:0 auto; padding:10px 25px; background:url(images/body_bg.png);}
.body h2 { font: normal 24px Arial, Helvetica, sans-serif; color:#494848; padding:15px 0; margin:0;}
.body h2 span { display:block; font: normal 11px Arial, Helvetica, sans-serif; color:#b7b7b7; padding:0; margin:0;}
.body .comment { float:right; width:44px; height:46px; background:url(images/comment_bg.gif) no-repeat; font:normal 22px Arial, Helvetica, sans-serif; color:#a4a4a4; line-height:38px; text-align:center;}
.body p { font:normal 12px Arial, Helvetica, sans-serif; color:#848484; line-height:1.8em; padding:5px 0; margin:0;}
.body p.about { background:#e6e6e6; border-left:5px solid #cdcdcd; padding:20px; margin:15px 0; font: italic 12px Arial, Helvetica, sans-serif; color:#747474;}
.body p span { font-size:18px; font-weight:bold; color:#888;}
.body a { color:#f0962e; text-decoration:none;}
.body ul.list { padding:0; margin:0; list-style:none;}
.body ul.list li { float:left; width:50%; padding:3px 0;}
.body img { margin:5px auto; padding:5px; background:#FFF; border:1px solid #d4d4d4;}
.body img.noborder { border:0; padding:0; margin:10px 10px 0 0;}
.body img.none { float:none; margin:0; padding:0; border:none; background:none;}
.body img.f_left { float:left;}
.body img.excel{}
the left css is
.left { width:601px; margin:0; padding:0 23px 0 0; float:left;}
the right css is
.right { width:286px; margin:0; padding:0; float:right;}
I don't see anything there that would explain why controls in the right <div> don't function correctly. There might be something happening in the code-behind, that I still can't see...
ASKER
at work I've simplified the whole project to just this code..
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class Default2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
}
protected void Button2_Click(object sender, EventArgs e)
{
List<string> selectedManagersList = new List<string>();
foreach (ListItem strItem in ListBox2.Items)
{
if (strItem.Selected)
{
selectedManagersList.Add(strItem.Value);
}
}
}
}
ASKER
i put in a Button on that right side and even that doesnt fire. To test I just added a button on right column that only adds 1+1. When you hit it on user side nothing happens at all
Do you have multiple <form> elements?
<form action="contact.php" method="post" id="contactform">
<form action="contact.php" method="post" id="contactform">
ASKER
there is one on the master.site page... and one on the page in question userform.aspx
OK, so the post back is going to contact.php page? That would prevent any events from getting processed.
ASKER
I have this line on my userform.aspx page..
However I do not know what is it or is doing? Can you explain what this form line does? And do I just delete it from my userform.aspx page?
<form action="contact.php" method="post" id="contactform">
However I do not know what is it or is doing? Can you explain what this form line does? And do I just delete it from my userform.aspx page?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
HALLELUIJA... it works!!!! thank you so much for your time and patience. You have no idea how many hours I spend on this. That was the problem... I used this template from another sheet, it has the form action section in it that was not needed and was screwing up this page.
THANK YOU !!!!
THANK YOU !!!!
ASKER
very very helpful and patient... problem solving went on for days and TheLearnedOne stayed and solved the issue
Is this a dynamic or static control?
How is the control configured in the HTML view?