How to maintain "session" state or the like for a show/hide menu when I click a sub link from an open block of sub category, like the one The Code Project did it on the left menu panel.
For example, if I click on "Web Development" link under "ARTICLES" category, it will show many links under the "Web Development" block. Click on a link in that open block, the page will refresh and show me article I wish to view. The problem I have is I can't figure out how to maintain session of the link I just clicked. That is keep the block "Web Development" open after the page refreshes.
I mean say you have a page called submitRequest.aspx
Now from your Asp page use:
<form action ="submitRequest.aspx" >
thus when the page is posted back it goes to submitRequest.aspx. You can get each of those form elements using Request object from submitRequest.aspx (even the IFrame) where page is your custom handler.
You can also use a class which inherits from IHttpHandler to call its process request.
I'm grateful for your answers, but I'm rather new to asp.net. How should I write to get a hold of the iframe. The iframe have id="left" in the asp page. But when I try Request["left"], I get null. And how am I going to change the src of the iframe.
I have already made this using Silverlight. There are lots of examples as well.
In case of normal ASP.NET, I guess you need to use SetInterval and continuously ping to an address to get update and update the chat window accordingly.
I guess you need to use SetInterval and continuously ping to an address to get update and update the chat window accordingly.
How do you ping to an address from JS?
This is not how web chat works. There should be a server and both clients will be connected to this server. The messages sent by both clients will be updated on the server and client just have to poll the server to get the message.
In the response from the server, I can see the new comment div added but the actual HTML of the page isn't updated, even though I've explicitly called updateComments.Update();.
The strange thing is if I do not do any AJAX/partial page postbacks before adding a comment via the button click, it works fine but after any AJAX/partial page postback (like adding a second comment without refreshing the page) I will see the new comment in the AJAX Response, but the HTML on the page isn't changed. Does anyone know why this is happening?
Probably not the case but I see that your UpdatePanel is set to ConditionalUpdate referring to btnSubmit's onclick event. OnClick is set to "btnSubmit_Click" however your update logic is within "button_click"!
Also, if above is not true, what exactly is Save() function doing which is being called onClientClick?
Thank you for the fast reply, alas I just 'shortcuted' the text to make it more readable, yes the button_Click method is actually btnSubmit_Click. I was just trying to follow the guidelines and make the code as small as possible.
The update panel is set to conditional, and at the very end of the event handler you will notice I called updateComments.Update();.
I am using tinyMCE inside the update panel (<uc1:xmsRichEditor ID="xmsRichEditor1" runat="server" UseFullEditor="false" />) and in order to reset the textbox with the value inside tinyMCE I need to do the following before posting back to the server:
document.getElementById("aspnetForm").elements["<%= xmsRichEditor1.UniqueID %>"].value = tinyMCE.get('<%= xmsRichEditor1.ClientID %>').getContent(); //this code works perfectly fine, has been for a while<br />
The thing is that If I add one comment, the AJAX postback works, and the new comment is added in a new div inside of divComments (divComments.Controls.Add(divComment);). But after posting one comment, if I try to post another one the Response I receive from the server (using firebug to inspect it) has the new divComment in the response html, but the html is never actually injected into the DOM.
To make sure that there was not some unhandled exception, I debugged the code. It works identically both times, and the Response from the server is identical each time (except the second time it includes a new div with the second comment) though the html in the update is not refreshed on the second postback.
Yeah I didn't think that was the case but I just wanted to make sure. Sometimes small things like that can cause major issues
Also, I looked at your website ... nice design. Unfortunately I wasn't able to get much in terms of, behavior or test data, from the comment page as I wasn't able to add a comment at all. It seemed like it worked at first but then I kept getting a 404 error.
I have never worked with tinMCE .... but if time allows I'll try to download tinyMCE and see if I can get it to work in a relatively simpler example similar to yours. Sorry wish I could be of more help.
Yup thats exactly the problem I'm having. The first time I submit a comment, it will add it to the page, after that, each sequential postback will send the correct response, but the html inside the update panel doesn't update...
Hi. I have a datagrid templatecolumn itemtemplate that I wish to set the rows according to the output row count from sql db. Rows count.
I have this on the html side which is generic.
<ItemStyle HorizontalAlign="Left" ForeColor="#CC0000" VerticalAlign="Top"></ItemStyle>
<asp:TextBox id=Textbox1 runat="server" Width="450px" Text='<%# DataBinder.Eval(Container, "DataItem.Comment") %>' BackColor="Transparent" BorderStyle="None" TextMode="MultiLine">
This is from the "with datagrid1" at page load
Dim cc as Integer
cc = DsgccV11.GCComents.Rows.Count()' Row count from sql
.AllowPaging = True
.PagerStyle.Mode = PagerMode.NextPrev
.PageSize = 25
.Items(1).Cells(3).Wrap = True
I gather the row count as shown in line (cc = DsgccV11.GCComents.Rows.Count()) This works fine. What I need to do is use the output cc number to set the "rows" for the (asp:TextBox id=Textbox1) property within the (TemplateColumn.ItemTemplate)