Showing posts with label create. Show all posts
Showing posts with label create. Show all posts

Wednesday, March 28, 2012

Updating a Text Box after the modalpopup closes.

Hi There

I'm attempting to create a function for users that allows them to browse their intranet site and save links within the intranet as a collection of 'my links'. To do this I'm using an iFrame embedded within the modalpopup extension. Everything is working with the exception of the final part (which is quite frustrating) - Basically I need to populate a textbox with the current location in the iFrame. I know that I'm ready the value correctly but the text box is just not updating. I've inserted the user control below - all you need to do is insert the control into a new page and then point the iframe at a starting page. Any help greatly appreciated as I could do with an answer to this issue as soon as possible.

<%@dotnet.itags.org. Control Language="C#" AutoEventWireup="true" CodeFile="test.ascx.cs" Inherits="includes_mylinks" %>
<%@dotnet.itags.org. Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<script type="text/javascript">
function onOk() {
var NewURLTextBox = parent.document.getElementById("<%= newurl.UniqueID %>");
var NavFrame = parent.frames(0);
NewURLTextBox.InnerText = NavFrame.location.href;
NewURLTextBox.InnerHTML = NavFrame.location.href;
NewURLTextBox.Value = NavFrame.location.href;
alert(NavFrame.location.href);
}
</script>
<asp:ScriptManager runat="Server" EnablePartialRendering="true" ID="ScriptManager" />
<h3>Add a new link</h3>
<table width="100%">
<tr>
<td style="width: 100px">Title:<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="newurldescription"
ErrorMessage="Please supply a Title" SetFocusOnError="True" ValidationGroup="NewURL">*</asp:RequiredFieldValidator>
</td>
<td><asp:TextBox runat="server" Text ="" ID="newurldescription" /></td>
</tr>
<tr>
<td>Address:<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="newurl"
ErrorMessage="Please specify the URL you wish to save" SetFocusOnError="True" ValidationGroup="NewURL">*</asp:RequiredFieldValidator>
</td>
<td><asp:TextBox runat="server" ID="newurl" EnableViewState="false" /> <asp:LinkButton ID="cmdBrowse"
runat="server">[Browse]</asp:LinkButton></td>
</tr>
<tr>
<td>Position:<asp:RangeValidator ID="RangeValidator1" runat="server" ControlToValidate="newurlposition"
ErrorMessage="Please enter a value between 1 and 9" MaximumValue="9" MinimumValue="1"
SetFocusOnError="True" Type="Integer" ValidationGroup="NewURL">*</asp:RangeValidator>
</td>
<td><asp:TextBox runat="server" Text ="" ID="newurlposition" MaxLength="1" Width="15px" /></td>
</tr>
</table>
<asp:ValidationSummary ID="ValidationSummary1" runat="server" />
<asp:Panel ID="BrowsePanel" runat="server">
<asp:Panel ID="Panel3" runat="server" Style="cursor: move;background-color:#DDDDDD;border:solid 1px Gray;color:Black">
<div>
<p>Navigate to the Page that you would like to add to My Links:</p>
</div>
</asp:Panel>
<iframe id="BrowseIntranet" runat="server" src="http://pics.10026.com/?src=default.aspx" height="450px" width="850px" ></iframe>
<p style="text-align: center;">
<asp:Button ID="OkButton" runat="server" Text="Select" />
<asp:Button ID="CancelButton" runat="server" Text="Cancel" />
</p>
</asp:Panel>
<cc1:ModalPopupExtender ID="ModalPopupExtender" runat="server"
TargetControlID="cmdBrowse"
PopupControlID="BrowsePanel"
BackgroundCssClass="modalBackground"
OkControlID="OkButton"
OnOkScript="onOk()"
CancelControlID="CancelButton"
DropShadow="false"
PopupDragHandleControlID="Panel3" />

Hi,

I was searching for somethig, but came across your post. I read an artcle to update the server control on postback. the url ishttp://www.aspdotnetcodes.com/ModalPopup_Postback.aspx . in this article they make use of label control, please try it with your TextBox.. and let me know if if helps you.

Thanks

Saturday, March 24, 2012

UpdatPanel and Session Variable

I have a treeview which populates a session variable when treeview items are selected. The session variable in turn is used to create a datatable. I have the datatable inside of an updatePanel and the trigger is the selectednodechanged event of the treeview. All of this works great. However, while the Session variable and resulting datatable are updated within the updatepanel the session variable is not updated/current when accessed by other controls/methods (that is- none of the treeview items placed inside of the session variable are there). Without the updatePanel changes to the session variable are "global" and seen by other callers. Is there any way to make the changes to the session variable that occur inside of the updatepanel "global"? Is there a way to place the session variable inside of the updatepanel?

Thanks in advance for any help or advice.

Hi rudolph41,

You should ask your question in the"Atlas" Discussion and Suggestions forum because that's where all theUpdatePanel experts are.

Thanks,
Ted

Upgrading ASP.NET 2.0 projects to Atlas

How do you upgrade an existing ASP.NET 2.0 project to Atlas? I already install the Atlas April 2006 CTP. I can create Atlas websites in VS 2005 but I want to upgrade some of the projects I have to Atlas.

hello.

well, you need to put the atlas dll on the bin folder, copy some entries from the default atlas web.config to your app's config and, if you're using bridges, add a new extension to iis.


bass_player...

Try these instructions on my blog -http://codebetter.com/blogs/jay.kimble/archive/2006/05/19/144952.aspx

I think they will help you out considerably.

Jay


bass_player...

Try these instructions on my blog -http://codebetter.com/blogs/jay.kimble/archive/2006/05/19/144952.aspx

I think they will help you out considerably.

Jay


Thanks a lot Jay, I really appreciate this. I just need to try it out. Will give you some updates.

Wednesday, March 21, 2012

Urgent: AJAX. Is this possible? Thank you.

Hello,

I am creating a web site which will have a mixture of AJAX and traditional.

Basically, I want to create a web site which will be tradicional as:

1. It has a master page and a child master page.

2. It has a menu which redirects to the various pages in the web site.

And it will have a few AJAX features:

1. Authentication using AJAX

2. Use of Update Panel so that I can update some content sections in each page without refreshing the entire web page.

My questions are:

1. Should I create an AJAX web site or a traditional web site and add the script manager to it?

I already added created an AJAX web site but when I added a Master page I got an error:

"Only one <configSections> element allowed per config file and if present must be the first child of the root <configuration> element.

The error was in code line "<%@dotnet.itags.org. Master Language="VB" CodeFile="MyMaster.master.vb" Inherits="MyMaster" %>" on file MyMaster.master

2. If you think I should create a traditional web site, then can I authenticate the users using AJAX?

Thank You,

Miguel

P.S: Sorry for the "Urgent" but I am completely stopped on this project and I have no idea which direction to take.




Hi,

I'm looking at similar issues in updating my website to 2.0. A couple of things from your post cought my eye. 1) I wouldn't have thought about using AJAX for authentication. As I understand AJAX it's only for client (browser) side features - that don't require a postback to the server (or limit the parts of a page that require postback). How then, can you use it for authentication? What, on the client side, can you be authenticating against?

As not all the AJAX stuff is ready for primetime, is that Ok with your plans for the website - how much pre-release bugs/changes will be Ok in your development and deployment? I'd probably be hesitant to use the CTP Codeplx stuff in a production site.

I don't see that having the website project AJAX enabled, would hurt, as it's just (I think), adding things needed to allow AJAX to work, not taking anything away from a ASP.Net 2.0 project/website.

A Bigger question might be what type of project - Website or Web Application Project (ala VS 2003 - using the add on for 2005). That's going to make a difference in your compilation scheme, and deployment issues.

For my site, I'm going to try using a single master page, but not use it for the first page, as I want that to have a unique (though compatible), style. I'll use CSS to keep things looking connected. I'm guessing - but don't know - that not having a masterpage for the default/index page will lessen the overhead a bit, and make it that much quicker to load. While broadband is ever more common, I still want a quick page for the default. With my site layout, I expect viewers to move to a content subject area, so a simple and clean fist page is Ok. It's also a place to offer an none BB, or text only , alternative. You can do this with a full feature page, but it can get very busy, and take so long to load that the point of the redirect is lost.

To go with this, I'm not sure if I'll want to use AJAX on that first page, or if having the site AJAX enabled, will not save anything by not using AJAX there. I have lots to do, and I'll check back at this post to see what others are saying about the ideas. Good luck. BRN..


Hi

I thought it doesnt really matter traditional web or AJAX web.

The only difference is AJAX web has script manager with it.

I worked with mater page with AJAX and found no trouble. The only thing you have to know is use script manager proxy for master/child page.

Cheers

MIB426

Use "Hello World Using Client Script" in UserControl

Hi

I want to create a asp.net user control for dynamic date entering, and I'm trying to use the same approach as in the example:

 <form runat="server">
<div>
Search for
<input id="SearchKey" type="text" />
<input id="SearchButton" type="button"
value="Search"
onclick="DoSearch()" />
</div>
</form>
<hr style="width: 300px" />
<div>
<span id="Results"></span>
</div>
<script type="text/javascript"
function DoSearch()
{
var SrchElem = document.getElementById("SearchKey");
Samples.AspNet.HelloWorldService.HelloWorld(SrchElem.value,
OnRequestComplete);
}

function OnRequestComplete(result)
{
var RsltElem = document.getElementById("Results");
RsltElem.innerHTML = result;
}

</script>

The problem is if I use <input id=SearchKey> -tag for the result, then there will be problems if I use the same control multiple times on one page (the id is not unique, and the OnRequestComplete will update every <input>-tag with id=SearchKey). If I change it to <input id=SearchKey runat=server>, asp will render unique id's for the <input>, but then .getElementById() does not find "object".

I have done a "workaround" where I passes the object's Id to the Webservice, and returns it in an array together with the result, but I don't think this is "a great way". Is there any other solution? A better one?

function DoSearch(CallerId)
{
var SrchElem = document.getElementById(CallerId);
Samples.AspNet.HelloWorldService.HelloWorld(this.id, SrchElem.value,
OnRequestComplete);
}

function OnRequestComplete(result)
{

var objectId = result[0].toString();
var WebServiceResult = result[1].toString();
var RsltElem = document.getElementById(objectId);
RsltElem.innerHTML = result;
}

Regards

Lars K.

This is a common problem... if you use ASP.NET server IDs you need to reference the client ID in client script:

var Ctl = $('<%= SearchKey.ClientID %>');

will do the trick in finding the control reliably.

You also need to use this if use MasterPages or any contained control, so as a general rule this is the best way to reference server based page variables.

+++ Rick --