Hello everyone i need help. Ive been having this problem for almost a day now. dropdown list won't populate from database
Below is the code i am using:
<%# Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="PhotoAlbum.aspx.vb" Inherits="PhotoAlbum" %>
Members Of Ephesians 5:10 Photo Album!
<asp:SqlDataSource ID="categoriesDataSource" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT [CategoryID], [Name] FROM [Categories] WHERE ([UserId] = #UserId) ORDER BY [Name]">
<SelectParameters>
<asp:QueryStringParameter Name="UserId" QueryStringField="ID"/>
</SelectParameters>
</asp:SqlDataSource>
<br />
<br />
<h1 style="font-weight:bold">Filter Pictures By Category:
<asp:DropDownList ID="categories" runat="server"
AppendDataBoundItems="True"
DataSourceID="categoriesDataSource" AutoPostBack="True"
DataTextField="Name" DataValueField="CategoryID">
</asp:Content>
i need help pls
set AutoEventWireup="true" in page directive
I quickly created a test page with following code, it works for me:
<%# Page Language="C#" AutoEventWireup="true" CodeFile="testddl.aspx.cs" Inherits="testddl" %>
<!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></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:DropDownList ID="DropDownList1" runat="server"
DataSourceID="SqlDataSource1" DataTextField="CategoryName"
DataValueField="CategoryID">
</asp:DropDownList>
</div>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:TESTDBConnectionString %>"
SelectCommand="SELECT [CategoryID], [CategoryName] FROM [Categories] WHERE ([UserID] = #UserID)">
<SelectParameters>
<asp:QueryStringParameter DefaultValue="1" Name="UserID" QueryStringField="ID"
Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
</form>
</body>
</html>
dbo.Categories:
Screenshot:
Related
I have a website where I use AJAX ModalPopupExtender to show error messages. It works fine on one of the pages.
I had to create another page for a new functionality and there the same code does not work, whatever I do.
I have created some simplified code to test this in general, but so far no cigar. This is my code:
the html:
<%# Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<!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>xxx</title>
<link href="Styles/StyleSheet.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form id="form1" runat="server">
<div id="Test_Main" class="main">
<asp:ScriptManager id="ScriptManager1" runat="server"></asp:ScriptManager>
<table border="0" cellpadding="0" width="970px" >
<tr>
<td rowspan="1" vertical-align="top" style="height: 80px">
<div class="header">
<h1><asp:Label id="lblOrder" width="930px" runat="server" Text="Order" style="margin-left: 10px"></asp:Label></h1>
</div>
</td>
</tr>
<tr>
<td rowspan="1" vertical-align="top" class="auto-style1" width="970px" >
<asp:UpdatePanel id="UpdatePanel2" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<uc2:TestOrder id="TestOrder1" runat="server" />
</ContentTemplate>
</asp:UpdatePanel>
</td>
</tr>
</table>
<div>
<asp:Button ID="Testbutton" runat="server" Text="Fenstertest" OnClick="Button_Test_Click"/>
</div>
</div>
<cc1:ModalPopupExtender ID="Testpanel" runat="server" BackgroundCssClass="ModalBackground" Enabled="true" TargetControlID="Testbutton"
PopupControlID="Panel1" CancelControlID="btnClose" BehaviorID="ModalBehaviourID">
</cc1:ModalPopupExtender>
<asp:Panel ID="Panel1" runat="server" CssClass="modalPanel" Style="display: none">
Test modal<br />
<asp:Button ID="btnClose" runat="server" Text="Close Modal" />
</asp:Panel>
</form>
</body>
</html>
and here is the code behind:
protected void Button_Test_Click(object sender, EventArgs e)
{
Testpanel.Show();
}
When I debug through the code, I see that the show method is executed, but then nothing is visible on the screen. When I execute without debugging, I see a short flickering, but no modal window.
My other page still works properly with that same method, this drives me crazy.
Does anyone see what is wrong here? Thanks for your help.
This is my menubar.jsp page. It contain some link when i am performing some action it is removing body tile Div tag element but not displaying another page
<%# page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%#taglib prefix="s" uri="/struts-tags"%>
<%# taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<link rel="stylesheet" type="text/css"
href="<c:url value="/resources/css/SpryMenuBarHorizontal.css"/>">
<script src="<c:url value="/resources/js/SpryMenuBar.js"/>"></script>
<script type='text/javascript'
src='https://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js'>
</script>
<script type="text/javascript">
function editr(val) {
alert("hi" + val);
$('#bodyTile').children().remove();
$('#bodyTile').load(val);
}
</script>
</head>
<body>
<div id="menuTile">
<ul id="MenuBar1" class="MenuBarHorizontal">
<li>Colleges</li>
<li><a class="MenuBarItemSubmenu" href="#">Syllabus</a>
<ul>
<s:iterator value="#session.course">
<li><a class="MenuBarItemSubmenu" href="#">
<s:property
value="courseName" /></a>
<ul>
<s:iterator value="semisters">
<li><s:url action="UrlTag1Link.action" var="urlTag1"
escapeAmp="false">
<s:param name="semisterId">
<s:property
value="semisterId" />
</s:param>
<s:param name="courseId">
<s:property
value="courseId" />
</s:param>
</s:url><a href="<s:property
value="#urlTag1" />"> <s:property
value="semisterName" /></a>
<ul>
<s:iterator value="subjects">
<li><s:url
action="urlTagLink.action" var="urlTag"
escapeAmp="false">
<s:param
name="semisterId">
<s:property
value="semisterId" />
</s:param>
<s:param
name="courseId">
<s:property
value="courseId" />
</s:param>
<s:param
name="subjectId">
<s:property
value="subjectId" />
</s:param>
</s:url> <a
href="javascript:editr('<s:property value="#urlTag" />')"><s:property
value="subjectName" /></a></li>
</s:iterator>
</ul></li>
</s:iterator>
</ul></li>
</s:iterator>
</ul>
<li>About Us</li>
<li>Contact Us</li>
<li>Logout</li>
</ul>
</div>
<script src="<c:url value="/resources/js/jquery-2.0.3.min.js"
/>"></script>
<script type="text/javascript">
var MenuBar1 = new Spry.Widget.MenuBar("MenuBar1", {
imgDown : "SpryAssets/SpryMenuBarDownHover.gif",
imgRight : "SpryAssets/SpryMenuBarRightHover.gif"
});
</script>
</body>
</html>
This is my Tile.xml
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE tiles-definitions PUBLIC
"-//Apache Software Foundation//DTD Tiles Configuration 2.0//EN"
"http://tiles.apache.org/dtds/tiles-config_2_1.dtd">
<tiles-definitions>
<definition name="welcome" template="/mau.jsp">
<put-attribute name="myHeader" value="/header.jsp" />
<put-attribute name="myMenubar" value="/menubar2.jsp" />
<put-attribute name="myRight" value="/right.jsp" />
<put-attribute name="myLeft" value="/left.jsp" />
<put-attribute name="myBody" value="/body.jsp" />
<put-attribute name="myFooter" value="/footer.jsp" />
</definition>
<definition name="page1" extends="welcome">
<put-attribute name="myBody" value="/page1.jsp" />
</definition>
<definition name="page2" extends="welcome">
<put-attribute name="myBody" value="/page2.jsp" />
</definition>
</tiles-definitions>
this is baseLayout jsp page (mau.jsp)
<%# page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%# taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<div style="width: 1000px height:600px;">
<table style="width: 100%;">
<tr>
<td colspan="3" style="height: 100px; background-color:
yellow;">
<div id="headerTile">
<tiles:insertAttribute name="myHeader" flush="false"
/>
</div>
</td>
</tr>
<tr>
<td colspan="3">
<div id="menuTile">
<tiles:insertAttribute name="myMenubar"
flush="false" />
</div>
</td>
</tr>
<tr>
<td height="60%" width="25%">
<div id="leftTile"
style="width: 100%; height: 400px; background-color:
green;">
<tiles:insertAttribute name="myLeft" flush="false" />
</div>
</td>
<td>
<div id="bodyTile" style="width: 100%; height: 400px;">
<tiles:insertAttribute name="myBody" flush="false" />
</div>
</td>
<td height="60%" width="25%">
<div id="rightTile"
style="width: 100%; height: 400px; background-color:
red;">
<tiles:insertAttribute name="myRight" flush="false"
/>
</div>
</td>
</tr>
<tr>
<td colspan="3">
<div id="footerTile">
<tiles:insertAttribute name="myFooter" flush="false"
/>
</div>
</td>
</tr>
</table>
</div>
</body>
</html>
this is action defined in Struts.xml
<action name="urlTagLink"
class="org.srtmun.student.action.UrlTagLinkAction"
method="subjectName">
<result name="page1" type="tiles" >page1</result>
</action>
<action name="UrlTag1Link"
class="org.srtmun.student.action.UrlTag1LinkAction"
method="semisterName">
<result name="page2" type="tiles">page2</result>
</action>
I think this issue for executed second line before the first line fully completed.
Try with use settimeout function or when/then or deffered-Promise functionality in jquery.
i am trying to this plugin https://developer.snapappointments.com/bootstrap-select/
It transforms your select into a bootstrap dropdown button. It keeps the select to keep the form consistency, so you can submit the selected value.
however, no transformation occurs.
<%# Master Language="C#" AutoEventWireup="true" CodeBehind="Site1.master.cs" Inherits="Final_Year_Project_Allocation_System.Site1" %>
<!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">
<!-- Bootstrap -->
<link href="bootstrap/css/bootstrap.min.css" rel="stylesheet" media="screen" />
<script src="http://code.jquery.com/jquery-latest.js" type="text/javascript"></script>
<script src="bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.2/themes/smoothness/jquery-ui.css" />
<!-- styling select -->
<link href="silviomoreto-bootstrap-select-d4ec9bd/bootstrap-select.css" rel="stylesheet"
type="text/css" />
<script src="silviomoreto-bootstrap-select-d4ec9bd/bootstrap-select.js" type="text/javascript"></script>
<link href="silviomoreto-bootstrap-select-d4ec9bd/bootstrap-select.min.css" rel="stylesheet"
type="text/css" />
<script src="silviomoreto-bootstrap-select-d4ec9bd/bootstrap-select.min.js" type="text/javascript"></script>
<title>:: Project Allocation System</title>
<asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
<div class="container-fluid">
<form id="form1" runat="server" class="form-horizontal">
<div class="span12"><br /><br /><br /></div>
<div class="row-fluid">
<div class=" span3">
<!--Sidebar content-->
<asp:ContentPlaceHolder ID="SideBarContent" runat="server">
</asp:ContentPlaceHolder>
</div>
<div class="span9">
<!--Body content-->
<asp:ContentPlaceHolder ID="BodyContent" runat="server">
**<select class="selectpicker">
<optgroup label="Picnic">
<option>Mustard</option>
<option>Ketchup</option>
<option>Relish</option>
</optgroup>
<optgroup label="Camping">
<option>Tent</option>
<option>Flashlight</option>
<option>Toilet Paper</option>
</optgroup>
</select>**
</asp:ContentPlaceHolder>
</div>
</div>
</form>
</div>
</body>
</html>
I have a web page that has a masterpage. It has two drop downs. On Selected index chagne of dropdown1, I am calling the dropdown1_selectedindex changed. But nothing happens when I change the selection in the first drop down. I have placed the script manager in the master page. Update panel in the control page. The update panel encloses both the drop downs. Pelase help me. I am a starter and I thought this will be pretty straight forward. What am I missing here?
This is the .aspx
<%# Page Language="C#" AutoEventWireup="true" MasterPageFile="~/Site.master" CodeBehind="Emailer.aspx.cs" Inherits="ServiceAlertEmailerGUI.Emailer" %>
<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
<%-- <h2>
Welcome to ASP.NET!
</h2>--%>
<%-- <p>
To learn more about ASP.NET visit www.asp.net.
</p>--%>
<%-- <p>
You can also find <a href="http://go.microsoft.com/fwlink/?LinkID=152368&clcid=0x409"
title="MSDN ASP.NET Docs">documentation on ASP.NET at MSDN</a>.
</p>--%>
<script type="text/javascript">
function HandleIT() {
alert("called");
}
</script>
<asp:Label ID="Label1" runat="server" Text="Status:"></asp:Label>
<asp:RadioButton ID="RadioButton1" Text="New Alert" GroupName="Status" runat="server" />
<asp:Label ID="Label2" runat="server" Text="Select Application: "></asp:Label>
<asp:UpdatePanel runat="server" ChildrenAsTriggers="true" UpdateMode="Conditional">
<ContentTemplate>
<asp:DropDownList ID="ddApplicationList" runat="server"
OnSelectedIndexChanged="ddApplicationList_SelectedIndexChanged">
</asp:DropDownList>
<br />
<asp:RadioButton ID="RadioButton2" GroupName="Status" Text="Update" runat="server" />
<asp:Label ID="Label3" runat="server" Text="Select Service: "></asp:Label>
<asp:DropDownList ID="ddServcieList" runat="server" >
</asp:DropDownList>
</ContentTemplate>
<%--
<Triggers>
<asp:AsyncPostBackTrigger ControlID="ddApplicationList" EventName="ddApplicationList_SelectedIndexChanged" />
</Triggers>
--%>
</asp:UpdatePanel>
<br />
<asp:RadioButton ID="RadioButton3" GroupName="Status" Text="Resolved" runat="server" /><br />
<asp:RadioButton ID="RadioButton4" GroupName="Status" Text="Resolved (No Email)" runat="server" />
<asp:Button ID="Button1" runat="server" Text="Build Template" Width="144px" />
<br />
<asp:RadioButton ID="RadioButton5" GroupName="Status" Text="Root Cause" runat="server" /><br />
<br />
</asp:Content>
Here is master page
<%# Master Language="C#" AutoEventWireup="true" CodeBehind="Site.master.cs" Inherits="ServiceAlertEmailerGUI.SiteMaster" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head runat="server">
<title></title>
<link href="~/Styles/Site.css" rel="stylesheet" type="text/css" />
<asp:ContentPlaceHolder ID="HeadContent" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
<form runat="server">
<asp:ScriptManager ID="AjaxManager" EnablePageMethods ="true" EnablePartialRendering = "true" runat="server">
</asp:ScriptManager>
<div class="page">
<div class="header">
<div class="title">
<h1>
Service Alert Emailer
</h1>
</div>
<%-- <div class="loginDisplay">
<asp:LoginView ID="HeadLoginView" runat="server" EnableViewState="false">
<AnonymousTemplate>
[ Log In ]
</AnonymousTemplate>
<LoggedInTemplate>
Welcome <span class="bold"><asp:LoginName ID="HeadLoginName" runat="server" /></span>!
[ <asp:LoginStatus ID="HeadLoginStatus" runat="server" LogoutAction="Redirect" LogoutText="Log Out" LogoutPageUrl="~/"/> ]
</LoggedInTemplate>
</asp:LoginView>
</div>--%>
<div class="clear hideSkiplink">
<asp:Menu ID="NavigationMenu" runat="server" CssClass="menu" EnableViewState="false" IncludeStyleBlock="false" Orientation="Horizontal">
<Items>
<asp:MenuItem NavigateUrl="~/Default.aspx" Text="Emailer"/>
<%--<asp:MenuItem NavigateUrl="~/About.aspx" Text="About"/>--%>
</Items>
</asp:Menu>
</div>
</div>
<div class="main">
<asp:ContentPlaceHolder ID="MainContent" runat="server"/>
</div>
<div class="clear">
</div>
</div>
<div class="footer">
</div>
</form>
</body>
</html>
Thanks guys for trying to help.
I figured out the mistake in the trigger. In the trigger, eventname should be the event name SelectedIndexChanged rather that ddApplicationList_SelectedIndexChanged.
<Triggers>
<asp:AsyncPostBackTrigger ControlID="ddApplicationList" EventName = "SelectedIndexChanged"/>
</Triggers>
sorry I lost the other link that gave me this answer.
We have an running application that is developed in struts-2.0.14. In this we used Ajax theme for displaying contents.
This ajax theme is running properly in all browsers except IE9 browsers, In IE9 this ajax theme making problem . The result is showing in new tab instead of showing in target element(div) specified by targets property.
Parent Page
<%#page contentType="text/html" pageEncoding="UTF-8"%>
<%# taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<s:head theme="ajax" debug="false" />
</head>
<body>
<s:url id="changePwd" action="changePassword" />
<s:div theme="ajax" id="pwdDiv" executeScripts="true" href="%{changePwd}" loadingText="Loading..."/>
</body>
</html>
Inner page
<%#page contentType="text/html" pageEncoding="UTF-8"%>
<%# taglib prefix="s" uri="/struts-tags" %>
<%# taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
<s:form action="changePassword" id="resetPassword" name="resetPassword">
<s:textfield name="username" id="username" />
<s:password showPassword="true" name="newpassword" id="newpassword" value="%{newpassword}"/>
<s:password showPassword="true" name="confirmpassword" id="confirmpassword" value="%{confirmpassword}"/>
<s:submit value="Confirm" showLoadingText="false" onclick="clearMsg();" theme="ajax" targets="pwdDiv" executeScripts="true" cssClass="userbutton" />
</s:form>
When Submitting the form in Inner Page the resulting page is popup into new tab. actually it should replace the content of pwdDiv.
Note: the same working properly in other browsers including (IE7,8)
Update:
making showLoadingText as true making the request as Ajax but the values are passed as null (password,confirm password ect,. -all fields)
Adding type="button" in s:submit button solve the problem. Don't know what is behind this !
<s:submit **type="button"** value="Confirm" showLoadingText="false" onclick="clearMsg();" theme="ajax" targets="pwdDiv" executeScripts="true" cssClass="userbutton" />