|
Thank's for your answer, but I can't convert or not allowed to convert tha asp page to aspx. What do you mean by post back to the aspx page. And what is custom handler.
Fia
|
|
|
|
|
I mean say you have a page called submitRequest.aspx
Now from your Asp page use:
<br />
<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.
On the other hand, how could you access the iframe from the server side, if your actual parent page is made using asp. You better use javascript to get reference from Iframe if you do require.
I hope you got my point.
|
|
|
|
|
Hi again
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.
Hope you have time to help me more
Fia
|
|
|
|
|
I think you need to use Javascript to communicate between the two pages, one the page that is loaded in iFrame and another is what is written in asp.
If you can submit the asp page in a handler custom handler and access Request.Params to get the controls.
|
|
|
|
|
Hi again
Do you have any code so I can see what I have to do. I don't know how to submit a page and I don't know how to use a custom handler. I have googled, but havent found anything I can use.
Regards
Fia
|
|
|
|
|
I m new in web application also in asp dotnet application .... In my Test application , i would like to create a chat application... Give some tips and valid tutorial
Thanks
|
|
|
|
|
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.
Use this tutorial for help :
Simple Chat Application in ASP.NET[^]
Cheers
|
|
|
|
|
Abhishek Sur wrote: 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.
Best wishes,
Navaneeth
|
|
|
|
|
By the sentence I meant to create one XmlHttp object and ping the server for the update. From the other end if some update is made to the server, it will get it .
N a v a n e e t h wrote: 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.
So, this is what exactly I meant.
Cheers.
|
|
|
|
|
Google[^] would be a good place to start. Plenty of samples out there if you are prepared to do a tiny bit of research.
If you have knowledge, let others light their candles at it.
Margaret Fuller (1810 - 1850)
www.JacksonSoft.co.uk
|
|
|
|
|
Hello fellow coders,
I am having a strange problem which I've never run in to previously.
The Problem:
I am getting back the new HTML in the AJAX postback, but the DOM / page isn't updating.
How it happens::
Whenever a user clicks the button 'Add Comment' the the following code is called:
<br />
button_click(...)<br />
{<br />
...<br />
IXmsComment cmt = new IXmsComment();<br />
cmt.content = content;<br />
cmt.date = DateTime.Now;<br />
cmt.username = tbxUsername.Text;<br />
AddComment(cmt);<br />
if (divComments.Visible == false)<br />
divComments.Visible = true;<br />
updateComments.Update();<br />
}<br />
<br />
... AddComment(IXmsComment cmt)<br />
{<br />
HtmlGenericControl divComment = new HtmlGenericControl("div");<br />
HtmlGenericControl divAuthor = new HtmlGenericControl("div");<br />
HtmlGenericControl divDate = new HtmlGenericControl("div");<br />
HtmlGenericControl divDescrip = new HtmlGenericControl("div");<br />
divComment.Attributes.Add("class", "comment");<br />
divAuthor.Attributes.Add("class", "commentAuthor");<br />
divDate.Attributes.Add("class", "commentDate");<br />
divDescrip.Attributes.Add("class", "commentDescription");<br />
divAuthor.InnerText = cmt.username;
divDate.InnerText = cmt.date.ToString();
divDescrip.InnerHtml = cmt.content;
divComment.Controls.Add(divAuthor);<br />
divComment.Controls.Add(divDate);<br />
divComment.Controls.Add(divDescrip);<br />
divComments.Controls.Add(divComment);<br />
xms.Utils.scriptCalls.AnimateStatus(divComment.ClientID, updateComments);<br />
UpdateProgress1.Visible = false;<br />
}<br />
Here is the update panel html:
<br />
<asp:UpdatePanel ID="updateComments" runat="server" UpdateMode="Conditional"><br />
<Triggers><br />
<asp:AsyncPostBackTrigger ControlID="btnSubmit" EventName="Click" /><br />
</Triggers><br />
<ContentTemplate><br />
<div id="divComments" class="commentCollection" runat="server"></div><br />
<div id="divNewComment" class="newComment" runat="server" visible="false"><br />
<fieldset><br />
<legend id="addCommentTitle" runat="server">Add Your Comment:</legend><br />
<table><br />
<tr><br />
<td><br />
<asp:Label ID="lblUsername" AssociatedControlID="tbxUsername" runat="server" Text="Your Username: "></asp:Label></td><br />
<td><br />
<asp:TextBox ID="tbxUsername" Enabled="false" runat="server"></asp:TextBox></td><br />
</tr><br />
<tr><br />
<td><br />
<asp:Label ID="lblEmail" AssociatedControlID="tbxEmail" runat="server" Text="Your Email: "></asp:Label></td><br />
<td><br />
<asp:TextBox ID="tbxEmail" runat="server"></asp:TextBox><br />
<asp:RequiredFieldValidator ID="rfvEmail" runat="server" <br />
ControlToValidate="tbxEmail" ValidationGroup="CommentGroup"<br />
ErrorMessage="Email Address is required." Display="Dynamic" <br />
SetFocusOnError="True"></asp:RequiredFieldValidator><br />
<asp:RegularExpressionValidator ID="revEmail" runat="server"<br />
ControlToValidate="tbxEmail" ValidationGroup="CommentGroup" <br />
ErrorMessage="Invalid Email Address" Display="Dynamic" <br />
SetFocusOnError="True" <br />
ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"></asp:RegularExpressionValidator><br />
<asp:CustomValidator ID="cvEmail" runat="server" Display="Dynamic" ControlToValidate="tbxEmail" ValidationGroup="CommentGroup" <br />
ErrorMessage="Email Address provided does not match the email address in our records for your user account. Please re-enter your email address." <br />
onservervalidate="cvEmail_ServerValidate" SetFocusOnError="True" ValidateEmptyText="true"></asp:CustomValidator><br />
<span class="req"></span></td><br />
</tr><br />
<tr><br />
<td><br />
<asp:Label ID="lblCaptcha" AssociatedControlID="imgCaptcha" runat="server" Text="Enter the text in the image:"></asp:Label></td><br />
<td><asp:Image ID="imgCaptcha" runat="server" /></td><br />
</tr><br />
<tr><br />
<td><br />
<asp:Label ID="lblCaptchaBox" AssociatedControlID="tbxCaptcha" runat="server" Text="Enter image text here:"></asp:Label></td><br />
<td><br />
<asp:TextBox ID="tbxCaptcha" runat="server"></asp:TextBox><br />
<asp:CustomValidator ID="cvCaptcha" runat="server" <br />
ControlToValidate="tbxCaptcha" ValidateEmptyText="true" ValidationGroup="CommentGroup"<br />
ErrorMessage="You must enter the text exactly as it appears in the image above." <br />
Display="Dynamic" onservervalidate="cvCaptcha_ServerValidate" <br />
SetFocusOnError="True"></asp:CustomValidator><br />
<asp:RequiredFieldValidator ID="rfCaptcha" ValidationGroup="CommentGroup" ControlToValidate="tbxCaptcha" SetFocusOnError="true" runat="server" ErrorMessage="Image verification is required."></asp:RequiredFieldValidator><br />
<span class="req"></span></td><br />
</tr><br />
<tr><br />
<td colspan="2" style="text-align:center;"><asp:Label ID="lblContent" AssociatedControlID="xmsRichEditor1" runat="server" Text="Your Comment:"></asp:Label></td><br />
</tr><br />
<tr><br />
<td colspan="2"><br />
<uc1:xmsRichEditor ID="xmsRichEditor1" runat="server" UseFullEditor="false" /><br />
</td><br />
</tr><br />
<tr><br />
<td> </td><br />
<td><br />
<asp:UpdateProgress ID="UpdateProgress1" AssociatedUpdatePanelID="updateComments" runat="server"><br />
<ProgressTemplate><br />
<div style="width:100%; margin:0 auto;"><br />
<img runat="server" id="imgLoader" src="~/App_Themes/default/images/ajax-mini-loader.gif" alt="loading... please wait." title="loading... please wait." /><br />
</div><br />
</ProgressTemplate><br />
</asp:UpdateProgress> <br />
<asp:Button ID="btnSubmit" ValidationGroup="CommentGroup" CausesValidation="true" runat="server" Text="Add Comment" <br />
onclick="btnSubmit_Click" OnClientClick="Save();" /></td><br />
</tr><br />
</table><br />
<div id="divResult" class="status" runat="server" style="font-weight:bold;"></div><br />
</fieldset><br />
</div><br />
</ContentTemplate><br />
</asp:UpdatePanel><br />
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?
Thanks,
Shawn
|
|
|
|
|
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?
|
|
|
|
|
Hi Student
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:
<br />
document.getElementById("aspnetForm").elements["<%= xmsRichEditor1.UniqueID %>"].value = tinyMCE.get('<%= xmsRichEditor1.ClientID %>').getContent();
If you want to see this page in its live environment you can see it here: http://blabberjax.com/singlePage.aspx?id=3[^]
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.
modified on Monday, November 9, 2009 7:45 PM
|
|
|
|
|
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.
Good luck.
|
|
|
|
|
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.
-----------------------------------------------------------
<asp:TemplateColumn HeaderText="Comment2">
<HeaderStyle Width="300pt"></HeaderStyle>
<ItemStyle HorizontalAlign="Left" ForeColor="#CC0000" VerticalAlign="Top"></ItemStyle>
<ItemTemplate>
<asp:TextBox id=Textbox1 runat="server" Width="450px" Text='<%# DataBinder.Eval(Container, "DataItem.Comment") %>' BackColor="Transparent" BorderStyle="None" TextMode="MultiLine">
</asp:TextBox>
</ItemTemplate>
-----------------------------------------------------------------------
This is from the "with datagrid1" at page load
With DataGrid1
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).Height.Point(cc)
.Items(1).Cells(3).Wrap = True
End With
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)
Help is greatly appreciated.
Thanks
Rick
|
|
|
|
|
Hi all,
I am using ASP.NET & SQL Server 2005. Whenever there are changes in database, I need to send an email automatically to administrator.
I am very please if you can tell me how I can "send an email automatically to administrator" when programming with C#?
Thank you very much!
|
|
|
|
|
Isn't this question be posted in database forum?
Please don't forget to mark 'Good Answer', if you find it really a good one!
Kashif
|
|
|
|
|
You can implement it two ways-
- SQL Server2005 itself provide notification service (Do some research)
OR
- Write a windows service priodically ping to database and send email
Parwej Ahamad
ahamad.parwej@gmail.com
|
|
|
|
|
I haven't understood so much about notification service. However, to notify the change of database I have used Service Broker of SQL Server 2005 & SqlDependency of C#.
Could you tell me more detail about "a windows service priodically ping to database and send email"? Which library of C# I should include? And could I use web service alternatly?
|
|
|
|
|
Try to followup step-
1- In database, create an extra column that will address send mail status
2- Create a windows and create there interval time like (30 Sec/15 Sec)
3- In this interval hit the database and check flag value of send mail status clumn, If it is flase then send email with required information
Note: You can many samples on codeproject itself or go with google.
Parwej Ahamad
ahamad.parwej@gmail.com
|
|
|
|
|
Choosing the right method depends on how fast you need the email to be send after the update. If you need immediate email notification, as suggested Windows services will be the choice. If you can afford a short delay, efficient approach would be to create a console application and schedule it using windows scheduler.
Best wishes,
Navaneeth
|
|
|
|
|
I suggest you do this via a trigger. Look into sp_send_dbmail and let the database handle the emails.
|
|
|
|
|
Can any One help,
How to play the .vox file in browser.
I can able to play .wav file in browser, but its not able to play the .vox file, because broswer asking the plugin MIME type (audio/voxware)
My requirement is .vox file should play in the browser when we click the Play button event using C# with Asp.Net 2.0
Thanks,
bruze
|
|
|
|
|
bruze wrote: broswer asking the plugin MIME type (audio/voxware)
Does that not offer a suggestion?
|
|
|
|