I have a problem with using a script that adds a NiceEdit toolbar to a text area when that text area is within an Ajax tab.
I want to know if I should refer to it in a different way than just the ID.
I mean the ID of that text area, I tried to take the text area outside the Tab Container, it works, but when I return it, it simply doesn't.
<%# Page Language="VB" ValidateRequest ="false" AutoEventWireup="false" CodeFile="tabbedNiceEditt.aspx.vb" Inherits="Client_tabbedNiceEditt" %>
<script src="../nicEdit/nicEdit.js" type="text/javascript"></script>
<script type="text/javascript">
bkLib.onDomLoaded(function() {
new nicEditor({buttonList : ['fontSize','fontFamily','fontFormat','bold','italic','underline','strikethrough','forecolor','bgcolor','removeformat'], iconsPath : '../nicEdit/nicEditorIcons.gif'}).panelInstance('txt');
});
</script>
<%# 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>Untitled Page</title>
<script type="text/javascript">
function pageLoad() {
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<cc1:TabContainer ID="TabContainer1" runat="server">
<cc1:TabPanel ID= "first" runat ="server" >
<ContentTemplate>
<b>Stuff Goes HERE</b>
<br />
<asp:TextBox ID = "txt" name = "txt" runat ="server" TextMode ="MultiLine" Height = "256" Width = "256">
</asp:TextBox>
<br />
<br />
<asp:Button id = "btn" runat ="server" Text = "click" />
</ContentTemplate>
</cc1:TabPanel>
<cc1:TabPanel ID = "second" runat ="server" >
<ContentTemplate>
<b>More Stuff for second tab</b>
</ContentTemplate>
</cc1:TabPanel>
</cc1:TabContainer>
</div>
</form>
</body>
</html>
txt is the server ID of your control, you have to use the client ID :
....panelInstance('<%= txt.ClientID %>');
Basically, the client ID is derived from the server ID and the naming container where your control is, to avoid any naming conflict. When your text area is not in the Ajax Tab, the client ID is the same as the server ID. When you put the text area in the Ajax Tab, it's client ID is different (you can check that by looking at the page source in your browser).
EDIT:
From Maen
I viewed the page in browser, checked
the ID in the page source, it was
"TabContainer1$first$txt", used it
instead of "txt" and the script was
like: panelInstance('<%=
txt.TabContainer1$first$txt %> I got
an error: BC30456: 'TabContainer1' is
not a member of
'System.Web.UI.WebControls.TextBox'.
That's not what I meant : you have to put panelInstance('<%= txt.ClientID %>') in your source code, and asp.net will convert that to panelInstance('TabContainer1$first$txt').
I told you to check the page source in the web browser just to see that the client Id was no longer "txt", but that it was constructed from the server ID and the naming container.
Related
I have an application that needs to open an external URL on the default Web Browser but I don't want to show the parameters on the URL so I think I need to make a POST instead of a GET, but how?
I'm using the following code to open an external default browser
Friend Sub WebOpen(ByVal WebAddress As String)
Dim sInfo As New ProcessStartInfo(WebAddress)
Process.Start(sInfo)
End Sub
But this expose all the parameters on the URL bar since make a GET not a POST.
Solution:
Make a temporary HTML file and open it using the previous code (WebOpen(ByVal WebAddress As String))
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- <!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" xmlns:v="urn:schemas-microsoft-com:vml">
<!-- <head>
</head> -->
<body>
<form name="Login" method="post" action="http://www.yourWebPage.com/" target="_self">
<input id="accountLoginField" class="textInput" name="account" value="accountX" size="24"
maxlength="32" type="hidden"/>
<input id="userLoginField" class="textInput" name="user" value="userX" size="24"
maxlength="32" type="hidden"/>
<input class="textInput" name="password" value="PassX" size="24" maxlength="32" type="hidden"/>
<input name="submit" value="Start Session" type="submit" id="btn" style="color: transparent;
background-color: transparent; border-color: transparent; cursor: default;"/>
<script type="text/javascript">
<!--
var counter = 0;
var maxCount = 50;
function pushSubmit() {
if (counter++ < maxCount) {
document.getElementById('btn').click();
}
}
//start the process
window.setTimeout(pushSubmit(), 30);
</script>
</form>
</body>
</html>
Hopefully you were able to find your answer using an older post from here: How to open IE with post info in C#?
Please mark this as an answer if this helped you solved your issue.
You could use a string encryptor in vb.net (you'll have to find that yourself) and then do this:
Process.Start(Decrypt("encryptedstringhere"))
That will 'hide' the parameters from anyone trying to decompile your code.
OR
Once you have compiled your executable, find a vb.net obfuscation program (just google it) and obfuscate your exe. This will make it unreadable to nayone who attempts to decompile it or find what string is in your parameters....
Hope this helped!
Rodit
I'm learning Spring and webflow and I'm having trouble with something which seems like it should be simple. My flow is capturing a query string parameter and stashing it in a flow-scoped variable when the flow begins. I'm trying to echo it on the first view-state. Errors ensue.
Here's the flow definition:
<?xml version="1.0" encoding="UTF-8"?>
<flow xmlns="http://www.springframework.org/schema/webflow"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/webflow
http://www.springframework.org/schema/webflow/spring-webflow-2.0.xsd">
<on-start>
<set name="flowScope.foo" value="requestParameters.fubar" />
</on-start>
<view-state id="step1" view="../jsp/step1.jsp">
<transition on="next" to="step2" />
</view-state>
<view-state id="step2" view="../jsp/step2.jsp">
<transition on="next" to="step3" />
<transition on="prev" to="step1" />
</view-state>
<view-state id="step3" view="../jsp/step3.jsp">
<transition on="prev" to="step2" />
<transition on="next" to="done" />
</view-state>
<end-state id="done" view="endView" />
<end-state id="cancelled" view="../jsp/cancelledView.jsp" />
<global-transitions>
<transition on="cancel" to="cancelled" />
</global-transitions>
</flow>
step1.jsp:
<%# page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%# taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%# taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%# taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%# taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Step 1</title>
</head>
<body>
This is step 1
<h1>flowRequestContext.flowScope: ${flowRequestContext.flowScope}</h1>
<h1>flowRequestContext.flowScope["foo"]: ${flowRequestContext.flowScope["foo"]}</h1>
<h2>${flowScope}</h2>
<c:if test="${empty flowScope}">
<h1>FLOW SCOPE IS EMPTY!</h1>
</c:if>
<c:if test="${!empty flowScope}">
<h1>FLOW SCOPE IS *NOT* EMPTY!</h1>
</c:if>
<c:if test="${empty flowRequestContext.flowScope}">
<h1>flowRequestContext.FLOW SCOPE IS EMPTY!</h1>
</c:if>
<c:if test="${!empty flowRequestContext.flowScope}">
<h1>flowRequestContext.FLOW SCOPE IS *NOT* EMPTY!</h1>
</c:if>
<form:form id="myForm">
<input type="submit" id="next" name="_eventId_next" value="Next" />
<input type="submit" name="_eventId_cancel" value="Cancel" />
</form:form>
</body>
</html>
Resulting error:
javax.el.PropertyNotFoundException: Property 'foo' not found on type org.springframework.webflow.core.collection.LocalAttributeMap
javax.el.BeanELResolver$BeanProperties.get(BeanELResolver.java:223)
javax.el.BeanELResolver$BeanProperties.access$400(BeanELResolver.java:200)
javax.el.BeanELResolver.property(BeanELResolver.java:311)
javax.el.BeanELResolver.getValue(BeanELResolver.java:85)
javax.el.CompositeELResolver.getValue(CompositeELResolver.java:67)
org.apache.el.parser.AstValue.getValue(AstValue.java:169)
org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:189)
...
If I omit the attempt to access the key "foo" the page renders with the following output (where the query string is ?fubar=baz):
This is step 1
flowRequestContext.flowScope: map['foo' -> 'baz', 'viewScope' -> map[[empty]]]
FLOW SCOPE IS EMPTY!
flowRequestContext.FLOW SCOPE IS *NOT* EMPTY!
It looks like the identifier flowRequestContext.flowScope does refer to a map, and it looks like it does contain the key and value I would expect... but if I try to access it like a map in EL it doesn't cooperate.
just use ${foo} everything in your flowscope should be accessible with $
I'm a total jQuery noob and I'm trying to use Eric Martin's SimpleModal Confirm Override dialog box in an ASP.Net web page. It's not working - no surprise, I have no idea what I'm doing! Here's a simplified version of my aspx page:
<%# Page Language="C#" AutoEventWireup="true" CodeBehind="Reimbursements.aspx.cs" Inherits="EAS.telecom.Reimbursements" MasterPageFile="~/common/default.master" Title="Reimbursements" %>
<%# Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<%# MasterType VirtualPath="~/common/default.master" %>
<asp:Content ID="Content1" runat="server" ContentPlaceHolderID="Main">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script type='text/javascript' src='~/jquery/confirm/js/jquery.js'></script>
<script type='text/javascript' src='~/jquery/confirm/js/jquery.simplemodal.js'>
$.modal('#confirm');</script>
<script type='text/javascript' src='~/jquery/confirm/js/confirm.js'></script>
<script language="javascript" type="text/javascript">
//some regular javascript here
</script>
<asp:Panel runat="server" ID="pnlEmployeeInfo" Enabled="false">
<div id='content'>
<div id='confirm-dialog'>
<h3>Confirm Override</h3>
<p>A modal dialog override of the JavaScript confirm function. Demonstrates the use of the <code>onShow</code> callback as well as how to display a modal dialog confirmation instead of the default JavaScript confirm dialog.</p>
<input type='button' name='confirm' class='confirm' value='Demo'/> or <a href='#' class='confirm'>Demo</a>
</div>
<!-- modal content -->
<div id='confirm'>
<div class='header'><span>Confirm</span></div>
<div class='message'></div>
<div class='buttons'>
<div class='no simplemodal-close'>No</div><div class='yes'>Yes</div>
</div>
</div>
<!-- preload the images -->
<div style='display:none'>
<img src='~/jquery/confirm/img/confirm/header.gif' alt='' />
<img src='~/jquery/confirm/img/confirm/button.gif' alt='' />
</div>
</div>
//more controls, including an AJAX TabContainer
</asp:Panel></asp:Content>
When I run the page, I see the Demo button and the Demo link, but clicking on them does nothing. What am I missing? Can I use SimpleModal on an ASP.Net page? Within a Content control? Thanks much!
Multiple issues here.
A script tag with a src cannot also contain script body. So, this is invalid.
<script src='~/jquery/confirm/js/jquery.simplemodal.js'>$.modal('#confirm');</script>
If you use an ID, SimpleModal is called like so: $('#content').modal();
That call needs to be within a click event handler.
<script>
$(document).ready(function () {
$('a.confirm').click(function () {
$('#content').modal();
});
});
</script>
I am using Microsoft Visual Studio Express to make a web page.
I used jQuery, to create a date picker from which I want to choose a date.
I want to read the date into a String in VB, so that I can modify it.
<%# Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title></title>
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.5/themes/base/jquery-ui.css"
type="text/css" media="all" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js" type="text/javascript"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.5/jquery-ui.min.js"
type="text/javascript"></script>
<script type="text/javascript">
$(function () {
$('#<%= TextBox1.ClientID %>').datepicker();
});
</script>
</head>
<body>
<form id="form1" runat="server">
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</form>
</body>
</html>
In VB I have tried:
Partial Class _Default
Inherits System.Web.UI.Page
Dim temp As String
temp = TextBox1.value
End Class
Why does it not work?
How should I do it?
I just tried your example using C# asp.net and with 2 changes i m able to see date...
1. add AutoPostBack="True" in textbox
2. in .cs use TextBox1.Text (valid for C# not sure of VB)
I've got a new solution that contains several project 'groups'. Each group contains a Cloud Project, a Web Role Project and a Test Project. All Web Role Projects are MVC4.
One of the Web Roles is the entry point for the visitor. Parts of what the visitor will see, should come from the other Web Roles from within the solution. I cannot get it working and after spending several hours googling, I still cannot solve it. Maybe anyone can be helpful on this issue.
For example, I need to fill the header content with data that I can get from one of the other Web Roles. Let's call that controller HeaderController. The controller in the main project (HomeController) looks like this:
public class HomeController : Controller
{
public ActionResult Index()
{
ViewBag.Message = "Modify this template to jump-start your ASP.NET MVC application.";
//var headerController = new Generic.HeaderFooterContainer.Controllers.HeaderController();
//var foo = headerController.Index().ExecuteResult();
//ViewBag.Header = headerController.;
return View();
}
In the comments are some things I've tried to debug some things.
Here's the page layout of the main project. The body is still empty, as this problem is just about the page header which could be placed as html from the ViewBag or ViewData or even with an own #section.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta charset="utf-8" />
<title>#ViewBag.Title</title>
<link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" />
<meta name="viewport" content="width=device-width" />
#Styles.Render("~/Content/css")
#Scripts.Render("~/bundles/modernizr")
</head>
<body>
<div class="headerHolder">
<div class="innertube">
<div id="header">
#ViewBag.Header
</div>
</div>
</div>
<div class="contentHolder">
<div class="innertube">
<div id="content">
#RenderBody()
</div>
</div>
</div>
<div class="footerHolder">
<div class="innertube">
<div id="footer">
</div>
</div>
</div>
#Scripts.Render("~/bundles/jquery")
#Scripts.Render("~/bundles/bms")
#RenderSection("scripts", required: false)
</body>
</html>
The problem I face is that I just can't find out how I should make this work. How do I get the data in the header? A few things I've noticed are:
If I run the HeaderFooterContainer project in its dedicated solution, it works alright (I can get /Header and get the expected response displayed in the browser window)
If I run the Main project, I can see the home page, but if I ask for /Header, it can find the controller, but not the view. It's probably looking for the view in the main project although it is located in the HeaderFooterContainer project.