Wednesday, March 28, 2012

updates, both session and deserialisation

hi,

I'm new to the forum and Asp.net ajax but have been a c# dev for a while. My question is regarding using the session from within Ajax, and also to boot reading in a file.

the following pseudocode outlines my problem, the button and label are both in update panel. which itself is working fine (as on the 2nd click the session variable is shown)

basically,

button1 click set session["test"] = hello;

in the page load event have

if(session != null) label1 = session[hello];

what gets me is why when clicking a link (still within the update panel) the session variable is shown, but not through the original request. As I thought the entire page cycle is processed at the server and only the items in the update panel (in this case update mode is always) are refreshed?

the same happens with deserialization when used from the wizard in an update panel, it loads up the previous file rather than the new one but i imagine its somthing I have done wrong...

I have a quick fix with a timer set to 1second and calling my refresh function. I've also looked at using the Ajax profile for storing data i would else have stored in the session.

I was just wondering if anybody could point out my mistake or offer any alternatives. (using the membership and roles isnt feasable on this project unfortunatly)

well cheers and im sure it must be just somthing i have missed!

initiagroup:

As I thought the entire page cycle is processed at the server and only the items in the update panel (in this case update mode is always) are refreshed?

That's correct.

Your problem sounds like it almost has to be a page life cycle issue. Can you post a little bit more code?


thanks for your quick reply. Here is an extremly simple code snippit that shows my problem... its ok i think i have worked it out. Am i right in thinking that even without the update panel that code wouldnt work?

1<%@. Page Language="C#" AutoEventWireup="true" CodeFile="test.aspx.cs" Inherits="test" %>23<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">45<html xmlns="http://www.w3.org/1999/xhtml" >6<head runat="server">7 <title>Untitled Page</title>8</head>9<body>10 <form id="form1" runat="server">11 <asp:ScriptManager ID="ScriptManager1" runat="server">12 </asp:ScriptManager>13 <div>14 <asp:UpdatePanel ID="upd1" runat="server">15 <ContentTemplate>16 <asp:label ID="lbl1" runat="server"></asp:label>17 <asp:Button ID="btn1" runat="server" Text="click" OnClick="btn1_Click" />18 </ContentTemplate>19 </asp:UpdatePanel>20 </div>21 </form>22</body>23</html>

and the code behind

1using System;2using System.Data;3using System.Configuration;4using System.Collections;5using System.Web;6using System.Web.Security;7using System.Web.UI;8using System.Web.UI.WebControls;9using System.Web.UI.WebControls.WebParts;10using System.Web.UI.HtmlControls;1112public partialclass test : System.Web.UI.Page13{14protected void Page_Load(object sender, EventArgs e)15 {16if (Session["test"] !=null)17 {18 lbl1.Text = Session["test"].ToString();19 }20 }21protected void btn1_Click(object sender, EventArgs e)22 {23 Session["test"] ="test";24 }25}26

as you see very easy just click the button and see what happens. In debug it hits the page load event after the button is pressed.

oh and its just a standard ajax template from the new website dialog box.

Cheers.

Updating a Cell (TD) in a Table

Hi all,

I am developing a webcontrol and I am also developing an AjaxExtender for these control...

Now the problem is when I register an click Event, I works fine, but I would like to replace the

value of one special cell with the result I get from Sys.Net.WebServiceProxy.invoke(),

since I am not so familiar with javaScript and all these Ajax stuff ;) I would like

to ask you guys if you have any advice for me to do that...

thanks in advance,

Omid

It depends a bit on your table structure and how you have things marked up with id's and so on. The easiest possible case is that your TD has a unique id, in which case you can easily say:

$get('idoftheelement').innerHTML = resultsOfTheInvoke;

if you don't have a unique id for it, it's somewhat more complex, but generally it's easiest if you use array notation, for example,

var table = $get('idOfthetable');

var rows = table.getElementsByTagName('TR");

var firstRow = rows[0];

var firstRowTds = firstRow.getElementsByTagName("TD");

var lastTd = firstRowTds[firstRowTds.length-1];

once you have the TD you want, you can set its innerHTML property to the texto f the result param.


hi Paul,

thank you very much for the advice...

My Table and rows and Cols have all an unique ID,

so I think $get('idoftheelement').innerHTML = resultsOfTheInvoke; fits to me...

redards Omid.

ps. I have another little question... what will happen if the ID is not Unique?? will I get an Array?


ID's have to be unique. I've honestly never tried to do them otherwise, since the spec requires them to be. I imagine you'd get different results in different browsers and depending on your doctype declaration.

one thing to watch out for when using the Id is that if your table is a server control and its inside a Master page or a User Control, then ASP.Net will munge the server-side ID to keep it unique (in case you have mulitple instances of the same control o nthe page, etc). The solution to that is to either not use the id (use some other means such as the one described) or else embed the server-generated id somewhere on the page inside a <script> block such as : var myTableId = '<%= tblMain.ClientID %>';

Updating a ContentPlaceHolder with Ajax

I am working on a project which uses a MasterPage with one ContentPlaceHolder. I have a custom menu control on the MasterPage. When an item in the menu is clicked I need the ContentPlaceHolder to be updated with the requested content. I know this can easily be done using an iframe, but I'd rather stay away from iframes and like to do this with Ajax.

Basically my question is if this is possible at all. I've been trying a couple of things but without success and I think it may have to do by the way a MasterPage works.
If not possible, is there some kind of workaround for this? (without residing to iframes)

Thanks!

Hi Rino,

I tried also the same thing as you. I had a menu on my master page and an ContentPlaceHolder in my update panel. That didn't work. I think it isn't possible what you want to do.

Regards,


Unfortunately, no. It's just not how master pages and AJAX work. I just finished a post on the topic here:http://odetocode.com/Blogs/scott/archive/2007/01/03/9682.aspx


Thanks guys for clearing this up!
Would be great as a new .Net feature though :)


You can do it right now, actually, it's not that big of a deal. You don't really need a contentplaceholder for it, just a Div that you can hook into w/ javascript (giving it an ID, for example). You have your menu item click handler fire a javascript function that calls a web service and then have the onrequest complete handler fill the div with the stuff it gets back.

paul.vencill:

You don't really need a contentplaceholder for it, just a Div that you can hook into w/ javascript (giving it an ID, for example). You have your menu item click handler fire a javascript function that calls a web service and then have the onrequest complete handler fill the div with the stuff it gets back.

Paul: Yes, but this is an entirely different approach.


Understood. I was trying to offer something that might work for his application. is there a good reason you can think of to limit his app to using contentplaceholders?

No, my goal was just to point out that updating content place holders with content from a different page isn't how the technologies work together. It seems to be a common question these days, so I'm trying to clear that up.

The right way to achieve this would be to use a solution like you proposed!


ah, ok, cool. :D

It is very easy.

See my last post about "Handling events...".

Updating a DataList with UpdatePanel

I've been trying to update my DataList with UpdatePanel but it's not working.

What I have is a text field for a user to enter comments and a save button, along with a DataList control all in an UpdatePanel.

Data is being saved on the table when the save button is clicked but the DataList is not updated unless I refresh the browser. What am I doing wrong?

Here is my ASP code:

 <asp:UpdatePanel ID="UpdatePanel3" runat="server"> <ContentTemplate> <asp:Panel ID="PanelCommentBody" runat="server" CssClass="collapsePanel" Width="451px"><br /> <asp:TextBox ID="txtComments" runat="server" Height="45px" TextMode="MultiLine" Width="412px" ValidationGroup="cmnts" ></asp:TextBox><br /> <asp:Label ID="lblComment" runat="server" Text="" Font-Size="Small"></asp:Label> <asp:RequiredFieldValidator ID="RFVComments" runat="server" ErrorMessage="Please enter comment." ValidationGroup="cmnts" ControlToValidate="txtComments" Font-Size="Small" Width="154px"></asp:RequiredFieldValidator> <asp:Button ID="bttnPostComment" runat="server" Text="Post Comment" OnClick="bttnPostComment_Click" ValidationGroup="cmnts" Width="122px" /> <asp:Button ID="bttnDiscard" runat="server" Text="Discard" OnClick="bttnDiscard_Click" CausesValidation="false" /> </asp:Panel> <cc1:CollapsiblePanelExtender ID="CollapsiblePanelExtender2" runat="server" CollapseControlID="closeComment" ExpandControlID="closeComment" TargetControlID="PanelCommentBody" Collapsed="true" SuppressPostBack="true"> </cc1:CollapsiblePanelExtender> <asp:DataList ID="DataList1" runat="server" DataSourceID="SqlDataSource1" Width="307px" Font-Size="Small"> <ItemTemplate> <strong>From: <a href="../Default.aspx?urnm=<%# Eval("UserName")%>"><asp:Label ID="FromLabel" runat="server" Font-Size="Small" Text='<%# Eval("UserName")%>'></asp:Label></a></strong> | Date Posted: <asp:Label ID="DateAddedLabel" runat="server" Text='<%# Eval("DateAdded", "{0:MMM dd, yy}")%>'></asp:Label><br /> <asp:Label ID="CommentLabel" runat="server" Text='<%# Eval("Comment")%>'></asp:Label><br /> <br /> </ItemTemplate> </asp:DataList><asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:MyDB%>" SelectCommand="SELECT [UserName], [Comment], [DateAdded] FROM [Comments] WHERE ([CL_Id] = @dotnet.itags.org.CL_Id) ORDER BY [DateAdded] DESC"> <SelectParameters> <asp:Parameter DefaultValue="1" Name="CL_Id" Type="String" /> </SelectParameters> </asp:SqlDataSource> </ContentTemplate> </asp:UpdatePanel>

Here is my Code Behind for the save button:

protected void bttnPostComment_Click(object sender, EventArgs e)
{
string flname = Request.QueryString["filename"];
flname = flname.Substring(0, flname.Length - 4);

if (User.Identity.IsAuthenticated)
{
MembershipUser myObject = Membership.GetUser();
string usrid = myObject.ProviderUserKey.ToString();
string usrname = User.Identity.Name;
string cmmnt1 = txtComments.Text;
string connStr = ConfigurationManager.ConnectionStrings["MyDB"].ConnectionString;
SqlConnection cnn = new SqlConnection(connStr);
SqlCommand cmd = new SqlCommand("INSERT INTO Comments (CL_Id, UserId, UserName, Comment) VALUES ('" + flname + "', '" + usrid + "', '" + usrname + "', '" + cmmnt1 +"')", cnn);
cnn.Open();
cmd.ExecuteNonQuery();
cnn.Close();
}
else
{
lblComment.Text = "You need to login to make comments";
}
}

----------

Thanks in advance,

Louis

1. Make UpdatePanel UpdateMode="Conditional"

2. after cnn.close(); write UpdatePanel3.Update()


Thanks siva sakki, I tried your suggestion but it still doesn't work.

What else can I try?

Louis


Updating a DataList with UpdatePanel

On Page_Load event, register DataList control

protected void Page_Load()
{
ScriptManager1.RegisterAsyncPostBackControl(DataList1);

DataList1.DataSource = this.SqlDataSource1;
DataList1.DataBind();
}


Thanks chetan, your suggestion might work. My problem is that I have the ScriptManger1 in the master page.

How can I reference this the way you have specified above?

Thank you,

Louis


I have tried the following to reference the the ScriptManger from content panel code behind:

ScriptManager.GetCurrent(this.Page).RegisterAsyncPostBackControl(DataList1);

is this the correct way of doing it? If it is my UpdatePanel still not updating. I have also removed this two lines:

//DataList1.DataSource = this.SqlDataSource1;
//DataList1.DataBind();

It is giving me this error:

Both DataSource and DataSourceID are defined on 'DataList1'. Remove one definition.

Do I need this two lines for it to work?

I am pulling my hair on this one.

Please help. Thanks again.

Louis


If you go back to the original code you submitted and add DataList1.DataBind() at the end of the button routine, you would probably achieve the results you want.

There is nothing to cause the DataList to rebind after the button event.

If you simply delete the UpdatePanel from the page, your code would not work either. As a rule, if doesn't work without Ajax, it won't work with it. The DataBinding event for the DataList has to run on the postback.


wrayx1 that did the trick.

Thank you soooo much!!!

Louis


Just do withDataList1.DataBind();

Let me know if this helps you


Okay, I have a similar question about updating using DataList. Will someone give me a hand on this. Here's what I have.

1<asp:ScriptManager ID="ScriptManager1" runat="server">2 </asp:ScriptManager>3<%--<asp:UpdatePanel ID="UpdatePanel1" runat="server">4 <ContentTemplate>--%>5 <asp:RadioButtonList ID="RadioButtonList1" runat="server" AutoPostBack="True">6 <asp:ListItem Value="True">Approved</asp:ListItem>7 <asp:ListItem Value="False" Selected="True">Not Approved</asp:ListItem>8 </asp:RadioButtonList>9 <asp:SqlDataSource ID="sqlApproval" runat="server" ConnectionString="<%$ ConnectionStrings:myConnStr%>"10 SelectCommand="SELECT [frstName], [lstName], [dvlID], [mdlName], [mdnName], [degree1], [degree2], [year1], [year2], [sp_frstName], [sp_lstName], [sp_year1], [sp_year2], [sp_mdlName], [sp_mdnName], [sp_degree1], [sp_degree2], [approval] FROM [dvlStory] WHERE ([approval] = @.approval)"11 DeleteCommand="DELETE FROM [dvlStory] WHERE [dvlID] = @.dvlID"12 InsertCommand="INSERT INTO [dvlStory] ([frstName], [lstName], [mdlName], [mdnName], [degree1], [degree2], [year1], [year2], [sp_frstName], [sp_lstName], [sp_year1], [sp_year2], [sp_mdlName], [sp_mdnName], [sp_degree1], [sp_degree2], [approval]) VALUES (@.frstName, @.lstName, @.mdlName, @.mdnName, @.degree1, @.degree2, @.year1, @.year2, @.sp_frstName, @.sp_lstName, @.sp_year1, @.sp_year2, @.sp_mdlName, @.sp_mdnName, @.sp_degree1, @.sp_degree2, @.approval)"13 UpdateCommand="UPDATE [dvlStory] SET [frstName] = @.frstName, [lstName] = @.lstName, [mdlName] = @.mdlName, [mdnName] = @.mdnName, [degree1] = @.degree1, [degree2] = @.degree2, [year1] = @.year1, [year2] = @.year2, [sp_frstName] = @.sp_frstName, [sp_lstName] = @.sp_lstName, [sp_year1] = @.sp_year1, [sp_year2] = @.sp_year2, [sp_mdlName] = @.sp_mdlName, [sp_mdnName] = @.sp_mdnName, [sp_degree1] = @.sp_degree1, [sp_degree2] = @.sp_degree2, [approval] = @.approval WHERE [dvlID] = @.dvlID">14 <SelectParameters>15 <asp:ControlParameter ControlID="RadioButtonList1" Name="approval" PropertyName="SelectedValue"16 Type="Boolean" />17 </SelectParameters>18 <DeleteParameters>19 <asp:Parameter Name="dvlID" Type="Int32" />20 </DeleteParameters>21 <UpdateParameters>22 <asp:Parameter Name="frstName" Type="String" />23 <asp:Parameter Name="lstName" Type="String" />24 <asp:Parameter Name="mdlName" Type="String" />25 <asp:Parameter Name="mdnName" Type="String" />26 <asp:Parameter Name="degree1" Type="String" />27 <asp:Parameter Name="degree2" Type="String" />28 <asp:Parameter Name="year1" Type="Int32" />29 <asp:Parameter Name="year2" Type="Int32" />30 <asp:Parameter Name="sp_frstName" Type="String" />31 <asp:Parameter Name="sp_lstName" Type="String" />32 <asp:Parameter Name="sp_year1" Type="Int32" />33 <asp:Parameter Name="sp_year2" Type="Int32" />34 <asp:Parameter Name="sp_mdlName" Type="String" />35 <asp:Parameter Name="sp_mdnName" Type="String" />36 <asp:Parameter Name="sp_degree1" Type="String" />37 <asp:Parameter Name="sp_degree2" Type="String" />38 <asp:Parameter Name="approval" Type="Boolean" />39 <asp:Parameter Name="dvlID" Type="Int32" />40 </UpdateParameters>41 <InsertParameters>42 <asp:Parameter Name="frstName" Type="String" />43 <asp:Parameter Name="lstName" Type="String" />44 <asp:Parameter Name="mdlName" Type="String" />45 <asp:Parameter Name="mdnName" Type="String" />46 <asp:Parameter Name="degree1" Type="String" />47 <asp:Parameter Name="degree2" Type="String" />48 <asp:Parameter Name="year1" Type="Int32" />49 <asp:Parameter Name="year2" Type="Int32" />50 <asp:Parameter Name="sp_frstName" Type="String" />51 <asp:Parameter Name="sp_lstName" Type="String" />52 <asp:Parameter Name="sp_year1" Type="Int32" />53 <asp:Parameter Name="sp_year2" Type="Int32" />54 <asp:Parameter Name="sp_mdlName" Type="String" />55 <asp:Parameter Name="sp_mdnName" Type="String" />56 <asp:Parameter Name="sp_degree1" Type="String" />57 <asp:Parameter Name="sp_degree2" Type="String" />58 <asp:Parameter Name="approval" Type="Boolean" />59 </InsertParameters>60 </asp:SqlDataSource>61 <br />62 <asp:DataList ID="dltApproval" runat="server" BackColor="White" BorderColor="#999999"63 BorderStyle="None" BorderWidth="1px" CellPadding="3"64 GridLines="Vertical" RepeatColumns="3" RepeatDirection="Horizontal" Width="700px" DataSourceID="sqlApproval">65 <FooterStyle BackColor="#CCCCCC" ForeColor="Black" />66 <SelectedItemStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White" />67 <ItemTemplate>68 <table border="0" cellpadding="2" cellspacing="0">69 <tr>70 <td>71 <asp:Label ID="frstNameLabel" runat="server" Text='<%# loadStory()%>'></asp:Label>72 </td>73 <td>74 <asp:CheckBox ID="chbApproval" runat="server" Checked='<%# Bind("approval")%>' />75 </td>76 </tr>77 </table>78 </ItemTemplate>79 <AlternatingItemStyle BackColor="Gainsboro" />80 <ItemStyle BackColor="#EEEEEE" ForeColor="Black" />81 <HeaderStyle BackColor="#000084" Font-Bold="True" ForeColor="White" />82 </asp:DataList>83<%-- </ContentTemplate>84 </asp:UpdatePanel>--%>85 <table border="0" cellpadding="5" cellspacing="0" width="700">86 <tr>87 <td style="width: 100px; text-align: center">88 <asp:Button ID="btnUpdate" runat="server" OnClick="btnUpdate_Click" Text="Update" /></td>89 <td style="width: 100px; text-align: center">90 <asp:Button ID="btnFinish" runat="server" OnClick="btnFinish_Click" Text="Finish" /></td>91 </tr>92 <>  

And here's the code behind:

1protected void Page_Load(object sender, EventArgs e)2 {34 }5protected string loadStory()6 {7//load the data in here and display to the lable control8return strInfoHolder.ToString() ;9 }10protected void btnUpdate_Click(object sender, EventArgs e)11 {12 sqlApproval.Update();13 dltApproval.DataBind();14 }15protected void btnFinish_Click(object sender, EventArgs e)16 {17 Response.Redirect("~/Admin/");18 }

The problem I have is that it's not updating. At the moment, I disabled the AJAX UpdatePanel to figure out the udpate first. All I wanted is to update the Approval checkbox to the sqlDataSource control. Noticed I used Bind instead of Eval for the checkbox control that way I was hoping that once I called the sqlApproval.Update() method, the approval checkbox will automatically update the database field. However, that is not so. Any help is appreciated.

Updating a FreeTextBox within an UpdatePanel

Hello everybody,

I'm working on a translation interface for a multilingual intranet. This leads me to use Rich TextBoxes such as FreeTextBox.

It is well known that there are issues about it when used with ajax.net, but I tried...


My issue:

I've got a page with three imbricated updatePanels. UpdatePanel1 contains both of the other update panels.

When updating these controls, I want a freeTextBox to get a text to translate.

But, not only does the FreeTextBox refuses to get the text, it also generates javascript errors that prevent me from openning an ajax modal popup.

I've tried to replace Freetextboxes by simple asp textboxes and this works fine... excepted as regards the fact that i can see all the html, and cannot put my text in form...

Coulds give me a hint to solve this? Do you know another rich text box with which i would have this issue?

Thanx a lot.

DART did the same thing, TinyMCE too... The only richTextBox I have tested which works is CuteEditor.

From what I've read, the issue comes from the focus on the textbox.

So no soultion for the moment.


Hi, I think I had the opposite problem to you. I could get the text by using .Text property but I couldn't set the text byassigning a new value to .Text.

I had to use the following code as a workaround : -

Private Sub SetEnoteText(ByVal strNotesAs String)Dim strScriptAs String =String.Format( _"$get('ctl00_maincontentarea_HeaderTabs_eNoteTab_eNoteText').value = '{0}';", _ strNotes.Replace(vbLf, "").Replace(vbCr, "")) strScript += "ctl00_maincontentarea_HeaderTabs_eNoteTab_eNoteText_Initialize(ctl00_maincontentarea_HeaderTabs_eNoteTab_eNoteText_editor, $get('ctl00_maincontentarea_HeaderTabs_eNoteTab_eNoteText'));" ScriptManager1.RegisterStartupScript(Me,Me.GetType(),"SETNOTE", strScript,True)End Sub
'ctl00_maincontentarea_HeaderTabs_eNoteTab_eNoteText' Being the ID of the FreeTextBox.
 
 

Updating a status label

I have a recently insalled the AJAX Beta 1 and I was wondering if it will enabled me to change a label multiple times in a sub... see the code below.

Protected Sub cmdSubmitUpload_Click(ByVal senderAs Object,ByVal eAs System.EventArgs)Handles cmdSubmitUpload.CliclblUploadStatus.Text ="Saving file on server..."'do the save herelblUploadStatus.Text ="Verifying file..."'call a routine that verifieslblUploadStatus.Text ="File verified."End Sub
I want to change the label and have the user see it change every time.  Is there a way to do this using AJAX?

Hello, the code that you write for an event handler will run on the server when the request is received, and the result of this is one and only one response that will update the page. If you want to provide this kind of feedback, you would need to write more client side code that executes each part of your process separately and can update the label before each step. You can seach msdn for a Whidbey feature called CallBacks that will allow you to do this, or you can make use of Atlas ability to call webservices from script.

Hope this helps,
Federico

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