|
Hi,
You need to use callback to server.
you need to use AJAX. A good option is to use microsoft's implementation of AJAX(codename ATLAS).
Check here: http://ajax.asp.net/
|
|
|
|
|
Hello,
The customer wants to download a music file for a path that is on the server, then play that in the web form. So it will be like having window media player embedded in the web form itself.
I have the code for downloading and playing. However, a dialog will popup and when they click open it will play the music. However, the customer doesn't like this and want to play the music in a player that is in the web page itself.
Here is my code so far for downloading and playing the music.
Many thanks
<br />
Try<br />
Dim fs As FileStream = Nothing<br />
Dim contentType As String = String.Empty<br />
'Dim path As String = "\\10.10.10.31\Inetpub\wwwroot\csone\images\Content\"<br />
'Dim fileName As String = "Voice.mp3"<br />
Dim path As String = "C:\DownloadPicture\"<br />
Dim fileName As String = "Beethoven.wma"<br />
<br />
<br />
fs = File.Open(path & fileName, FileMode.Open)<br />
Dim fileBytes(fs.Length) As Byte<br />
<br />
fs.Read(fileBytes, 0, fs.Length)<br />
fs.Close()<br />
<br />
Response.AddHeader("Content-disposition", "attachment; filename=" & fileName)<br />
Response.ContentType = "application/octet-stream"<br />
Response.BinaryWrite(fileBytes)<br />
HttpContext.Current.ApplicationInstance.CompleteRequest()<br />
<br />
Catch ex As Exception<br />
MsgBox(ex.Message)<br />
End Try
|
|
|
|
|
|
Use an EMBED tag and the SRC should be
playmusic.aspx?musicfile=someid
Depending upon this querystring, appropriately stream the MP3 by setting the MimeType properly.
Vasudevan Deepak Kumar
Personal Homepage Tech Gossips
A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis Levinson
|
|
|
|
|
Hi in my web.confif file i given session timeout...,
when the session timings out its redirect to the login page...,
But same statement if i use in my server system,its not considering the session part...,
This is my webconfig file contained session part:
<sessionState mode="InProc" stateConnectionString="tcpip=127.0.0.1:41414" sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes" cookieless="false" timeout="20"/>
whats the probs why its not accept the session part in server system?,
-- modified at 23:55 Monday 26th November, 2007
Thanks & Regards,
Mageshh,
please don't forget to vote on the post
|
|
|
|
|
Hai all in my application i am using Menu control.I am binding this menu with xml.
i need to hide some of the menu in my menu control based on one flag in my xml string.
From database i am taking that flag as a xml attribute in the same xml which i use to bind the menu.
Plse Help me
Thanks in advance
Lijo Rajan
|
|
|
|
|
xml file :
<one>
<two>india</two>
<three>america</three>
</one>
first ,the freetextbox should contain the xml file in pageload, i.e it displays
.india
.america
then when i change "india" or "america" to some other text then it should modify in the xml file after i click the button.
[i want to update the xml file i.e modify the the content in the child nodes i.e <two> and <three> using the freetextbox control. ]
|
|
|
|
|
I am having a little problem.... I have formview and within the ItemTemplate of the formview I have a tables with different controls. I won't to be able to loop through the formview and depending on the type of control do something with it. When I loop through it, it only says there are one control which is the table... Here are some snipetts.
<asp:FormView ID="FormView1" runat="server" Width="600" DataSourceID="dsCoursesAll" DataKeyNames="CourseID">
<ItemTemplate>
<table id="ScoreCard" runat="Server" class="ScoreCard" width="600">
<tr id="trScoreFrontNine">
<td>Score</td>
<td><asp:TextBox ID="txtScoreHoleOne" runat="Server" MaxLength="2" Width="55" /></td>
<td><asp:TextBox ID="txtScoreHoleTwo" runat="Server" MaxLength="2" Width="55"/></td>
<td><asp:TextBox ID="txtScoreHoleThree" runat="Server" MaxLength="2" Width="55"/></td>
<td><asp:TextBox ID="txtScoreHoleFour" runat="Server" MaxLength="2" Width="55"/></td>
<td><asp:TextBox ID="txtScoreHoleFive" runat="Server" MaxLength="2" Width="55"/></td>
<td><asp:TextBox ID="txtScoreHoleSix" runat="Server" MaxLength="2" Width="55"/></td>
<td><asp:TextBox ID="txtScoreHoleSeven" runat="Server" MaxLength="2" Width="55"/></td>
<td><asp:TextBox ID="txtScoreHoleEight" runat="Server" MaxLength="2" Width="55"/></td>
<td><asp:TextBox ID="txtScoreHoleNine" runat="Server" MaxLength="2" Width="55"/></td>
</tr>
</table>
Protected Sub btnReset_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnReset.Click
For Each c As Control In FormView1.Controls
If TypeOf c Is TextBox Then
CType(c, TextBox).Text = ""
ElseIf TypeOf c Is CheckBox Then
CType(c, CheckBox).Checked = False
End If
Next
End Sub
|
|
|
|
|
Hi,
Then try to loop through the Table(HtmlTable).
|
|
|
|
|
Hi,
I have a series of pages to create that will each have a bunch of listboxes on them, each containing a listing of files in a directory. I'm trying to get the page down to basics where i only have to plug in the correct paths to the folders, but I'm hitting a problem casting 'object sender' to a listbox - the SelectedItem is always the first item, not what was actually selected.
here is the entire code-behind (stripped down to basics):
public partial class departments_safety_play : System.Web.UI.Page {
private static readonly string year = DateTime.Now.Year.ToString();
private static readonly string root = @"../..//FIBRELINE/";
private readonly string pathFibrelineA = string.Format(@"{0}{1}/A-SHIFT/", root, year);
protected void Page_Load(object sender, EventArgs e) {
if (!IsPostBack) {
string folderToBrowse = Server.MapPath(pathFibrelineA);
utilityLib.ShowFilesInWithValue(folderToBrowse, lstFibrelineA, pathFibrelineA);
}
}
protected void lbSelectedIndexChanged(ListBox lb) {
string dir = lb.SelectedValue + lb.SelectedItem.Text;
string popupScript = "" +
"window.open('" + dir + "', 'CustomPopUp', " +
"'width=600, height=500, menubar=1, resizable=1, location=1')" +
"";
ClientScript.RegisterStartupScript(GetType(), lb.SelectedItem.Text, popupScript);
}
protected void SelectedIndexChanged(object sender, EventArgs e) {
ListBox lb = (ListBox) sender;
lbSelectedIndexChanged(lb);
}
}
|
|
|
|
|
Is it possible to loop through a database and display the names of all the tables? If so, please point me in the right direction.
|
|
|
|
|
Please do not respond. I found the solution.
|
|
|
|
|
Ok...
- Regards - JON Life is not measured by the amount of breaths we take, but by the moments that take our breath away.
|
|
|
|
|
I am trying to modify a webpage that includes the AJAX tools, but can not get AJAX installed. I have followed the steps using the Sample Web Site, but when I get to the point of adding the tool to the VS toolbar I get an error. “error loading types from Assembly…” “ Could not load file or assembly ‘System.Web.Extension…’ or one of its dependencies. The system could not find the file specified.”
I have VS 2005 Standard edition and have reinstalled ASP.NET.
Any idea what I might be doing wrong?
David Wilkes
|
|
|
|
|
Never mind, figured it out.
David Wilkes
|
|
|
|
|
Hi,
I have a web service and if my web method catches an exception I then throw a new exception which is passed back to my calling application. Unfortunately though my exception has text XXXXXXX, it gets a load of other stuff added like this:
"System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.Exception: ..."
It looks like I'm getting the inner exception trace.
How can I avoid this?
Thanks
|
|
|
|
|
Hi Friends
I am trying to pass value to my Session Variable from Javascript method.
function TestOne
{
var stringOne= "test";
Session.Add("Test", stringOne);
}
I am getting an error Session is undefined.
Any suggestions would be appreicated.
Thanks
Cheers
Menon
|
|
|
|
|
Session is a Sever object not client, so you cannot access it in javascript code. You have to pass the string to the server either through querystring or through any form field and then get it on the server and add it to the session
-----
|
|
|
|
|
Thanks Bhatti,
Can you please tell me how do you call a server side method from the Javascript?
Thanks
Cheers
Menon
|
|
|
|
|
What are you really trying to do? You are in ASP.NET forum which means you have an idea how web forms works. So basically you add a ASP:Button in you page and onclientclick you call the javascript function, in that function you change the value of any hidden field or regular textbox and submit the form. And on server side you add the click handler to the button and in that eevnt handler you get the value of that field.
Please go through quickstart tutorials[^] to understand the whole flow.
e.g. you will call the following javascript function onclicentclick of the button:
<br />
function TestOne()<br />
{<br />
document.myform.stringOne.value = 'stringOne';<br />
docuemt.myform.submit();<br />
}<br />
and on server side in event handler for click event of button you will do this:
<br />
Session["Test"] = stringOne.Value;<br />
-----
|
|
|
|
|
Hi all,
I have a multiline text box . I wan`t the user entered data to be filled in a single column of the table.But since the user can enter more than one line (by pressing enter or wrap i suppose).
It gives me an error that the data would be truncated. How should i enter the entire data in DB?
Also while reading i need to read it as a ordered list..How can we do that?
Any help would be highly appreciated
|
|
|
|
|
from the error it you are trying to save data that is larger than the allowed size in database. So either restrict the user to enter data for allowed size or increase the size in database.
newbie.net wrote: Also while reading i need to read it as a ordered list..How can we do that?
what you mean by "you want to read it as ordered list"?
-----
|
|
|
|
|
I have read a couple articles on how to encrypt portions of the web.config via command line, but is there any way to do something simillar when console/command line access is not available? such as in a hosted environment? I could possible make a request to the company hosting my asp.Net 2.0 site, but I thought that I had viewed a tutorial some time back where someone did it programatically.
P.S. Let me say to anyone that has noticed that this is my third quest for help this morning... I am new to this forum and promise to contribute back to the forum by helping others where I can. 8-)
|
|
|
|
|
What about doing this via cmd on your localmachine and update this portion in web.config from your host??
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
"Please vote to let me (and others) know if this answer helped you or not. A 5 vote tells people that your question has been answered successfully and that I've pitched it at just the right level. Thanks."
|
|
|
|
|