|
welcome sir
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
Hi,
I have a page which refresh every 3 - 5 seconds, i gave refresh in meta tag. While refreshing, as normal all the controls are dissapear and display a white page for some milliseconds. I need to block the controls from disappearing at the time of refresh. ie, the user should not understood that page is refreshing.
How can i do that
Thankyou
Ypki
|
|
|
|
|
What is use of refresh the whole page ? Do you want to update any particular section or value on your page ? Then why you are not looking into AJAX Update Panel and AJAX Timer control to refresh the particular section, rather than Refreshing whole page.
Thank You !
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
The whole page contain a dynamically created html table with number of cell, in each there will be a value, these values will change frequently. Thats why i am refreshing the whole page.The page contain only that html table.
In AJAX Update Panel also the controls will dissapear for some milli seconds..ryt??
|
|
|
|
|
Use AJAX based solution.
Say you load the page within a div.
During refresh, make an AJAX request which will get the latest data and show in the div.
To know how to do an AJAX request follow :
http://www.w3schools.com/Ajax/Default.Asp[^] tutorial.
|
|
|
|
|
Hi,
I am installed Visual studio 2008 team player in my system.I have to run MS Petshop web application on my system but whenever I am opening my project from VS 2008 and executing it,I am encountering an exception.If I installed petshop's just source code,it throws exception as system.typeinitialization exception. and if I am installing petshop completely ,it throws system.reflection.targetinvocation exception.Please help me solve this error.
Thanks!
|
|
|
|
|
If I'm having a form with n textboxs (n defined by te user by pressing a "new registry" button for example), and the textboxs are named product1, product2, ...productn..
How should I retrieve the data in the POST?
Should I send n thrue the form too?
What is the typical way of doing this kind of forms??.. that there is a main record in a db (for example some headers) and n records within that record? is there a good practice way?
The db would look like
table1: mainid, headers
table2: id, mainid, etc.
(ie. one to many relationship)
|
|
|
|
|
Quake2Player wrote: If I'm having a form with n textboxs (n defined by te user by pressing a "new registry" button for example), and the textboxs are named product1, product2, ...productn..
I guess you are creating dynamic textbox on Button Click.
The control which you are creating dynamically, you need to created before Page_Load() , other wise, it will not able to maintain the View State Data or will not load the Postback Data.
If you deeply look inside ASP.NET Page Life Cycle, Before Page_Load(), there are two different methods calls. 1) LoadViewState() and 2)LoadPostbackData() .
So, if you create any control on Page_Load() , or after that it will not able to load the data.
So you need to create such control either in Pre_Init() or Init() method.
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
That also applies for ASP.NET MVC? Which isnt that event oriented as pure ASP.net?
Anyway, is it ok the way im describing? To retrieve "n" and based on that retrieve the inputs.. or is there something like a container where i can do like "for each control in container" ?
|
|
|
|
|
my project is running locally fine. But when i upload it shows below error
[ArgumentNullException: Value cannot be null.
Parameter name: type]
System.Activator.CreateInstance(Type type, Boolean nonPublic) +7465206
System.Web.Profile.ProfileBase.CreateMyInstance(String username, Boolean isAuthenticated) +79
System.Web.Profile.ProfileBase.Create(String username, Boolean isAuthenticated) +231
System.Web.HttpContext.get_Profile() +107
ProductsAccordingCat.get_Profile() +49
ProductsAccordingCat.gotoCart(Object sender, EventArgs e) in ProductsAccordingCat.aspx.cs:696
System.Web.UI.ImageClickEventHandler.Invoke(Object sender, ImageClickEventArgs e) +0
System.Web.UI.WebControls.ImageButton.OnClick(ImageClickEventArgs e) +108
System.Web.UI.WebControls.ImageButton.RaisePostBackEvent(String eventArgument) +118
System.Web.UI.WebControls.ImageButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565
Please help me to solve this problem.
below is code
protected void gotoCart(object sender, EventArgs e)
{
ImageButton btn = (ImageButton)sender;
double Price = double.Parse(((Label)btn.Parent.FindControl("Price")).Text);//.Substring(8));
string ProductName = ((HyperLink)btn.Parent.FindControl("hlnkProductName")).Text;
string ImagePath = ((System.Web.UI.WebControls.Image)btn.Parent.FindControl("imgProduct")).ImageUrl;
string ProductID1 = ((HtmlInputHidden)btn.Parent.FindControl("hdnid")).Value;
string ParentID = ((HtmlInputHidden)btn.Parent.FindControl("hdnParentID")).Value;
int ProductID = Convert.ToInt32(ProductID1.Substring(1));
if (Profile.Cart == null) // here at this line it shows error
{
Profile.Cart = new shopping.ShoppingCart();
}
Profile.Cart.Insert(ProductID, Price,0, 1, ProductName, ImagePath);
Response.Redirect(ResolveUrl("~") + "Shopping_Cart/ShoppingCart.aspx");
}
modified on Tuesday, September 22, 2009 12:52 PM
|
|
|
|
|
Can you show us the code where it is breaking down? The stack helps, but not that much.
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|
|
below is code
protected void gotoCart(object sender, EventArgs e)
{
ImageButton btn = (ImageButton)sender;
double Price = double.Parse(((Label)btn.Parent.FindControl("Price")).Text);//.Substring(8));
string ProductName = ((HyperLink)btn.Parent.FindControl("hlnkProductName")).Text;
string ImagePath = ((System.Web.UI.WebControls.Image)btn.Parent.FindControl("imgProduct")).ImageUrl;
string ProductID1 = ((HtmlInputHidden)btn.Parent.FindControl("hdnid")).Value;
string ParentID = ((HtmlInputHidden)btn.Parent.FindControl("hdnParentID")).Value;
int ProductID = Convert.ToInt32(ProductID1.Substring(1));
if (Profile.Cart == null) // here at this line it shows error
{
Profile.Cart = new shopping.ShoppingCart();
}
Profile.Cart.Insert(ProductID, Price,0, 1, ProductName, ImagePath);
Response.Redirect(ResolveUrl("~") + "Shopping_Cart/ShoppingCart.aspx");
}
|
|
|
|
|
I would be interested to know if you ever found a solution. I too have recently come across this very same issue when trying to access the Profile object. I dont think it is related to this article some configuration issue on the server - look up MOSS and profile null.
|
|
|
|
|
While try to execute this code i get an error message " Invalid attempt to call Read when reader is closed."
Public Shared Function GetLMSSettings() As Hashtable
Dim h As Hashtable
h = CType(DataCache.GetCache("GetLMSSettings"), Hashtable)
If h Is Nothing Then
h = New Hashtable
Dim dr As IDataReader = SqlDataProvider.GetLMSSettings
While dr.Read()
If Not dr.IsDBNull(1) Then
h.Add(dr.GetString(0), dr.GetString(1))
Else
h.Add(dr.GetString(0), "")
End If
End While
dr.Close()
DataCache.SetCache("GetLMSSettings", h)
End If
Return h
End Function
|
|
|
|
|
befor below line you must check dr is nothing
While dr.Read()
|
|
|
|
|
c# .net 2.0 web application.
I have tried following code.It is working fine in Server box (I have created vitrual direcory for record folder in c: drive "),
but it not working in client box.
c:\\record\\record.wav"
Code
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Microsoft.VisualBasic.Devices;
using Microsoft.VisualBasic;
using System.Runtime.InteropServices;
public partial class Recording : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
[DllImport("winmm.dll", EntryPoint = "mciSendStringA", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
private static extern int mciSendString(string lpstrCommand, string lpstrReturnString, int uReturnLength, int hwndCallback);
protected void btnRecord_Click(object sender, EventArgs e)
{
mciSendString("open new Type waveaudio Alias recsound", "", 0, 0);
mciSendString("record recsound", "", 0, 0);
}
protected void btnSaveStop_Click(object sender, EventArgs e)
{
mciSendString("save recsound c:\\record\\record.wav", "", 0, 0);
mciSendString("close recsound ", "", 0, 0);
Computer c = new Computer(); c.Audio.Stop();
}
protected void btnRead_Click(object sender, EventArgs e)
{
Computer computer = new Computer();
computer.Audio.Play("c:\\record\\record.wav", AudioPlayMode.Background);
}
}
Thanks,
Bruze
|
|
|
|
|
This is the basics of ASP.NET. If you play audio using Computer.Audio.Play it will always run in the server.
What you have to do is to download the wav file to the client and then invoke the browser media object installed to run your wav file.
For simplicity you can also use
Body BgSound ="~/record.wav"
I recommend to read basic books before you do programming in Web Environment, as there is some problems in the basics of this environment. Hope you understand.
Also on your problem if you are using BgSound or anything, always refer to the Virtual path, as Physical path of your server is different from the clients.
|
|
|
|
|
Thanks For Your Reply.
Actually, First of all I want to record the audio and Save into Client box using browser.Once I recorded the audio file then Upload into Server folder.
Thanks,
Bruze
modified on Monday, September 21, 2009 5:29 PM
|
|
|
|
|
Yes. Say you upload a file into the server
say abc.wav
save this file into a directory which is within the virtual path. say c:\mywebsite\xyz folder.
so that you can call
http://yourserver.com/xyz/abc.wav
Now create your webpage such that it plays audio using this path.. not your original physical path.
Finally take any of the different steps mentioned here to play your sound in the browser:
http://www.phon.ucl.ac.uk/home/mark/audio/play.htm[^]
Hope you understand this.
|
|
|
|
|
I got it. Thank you So much for your reply
|
|
|
|
|
hi
through this code i am recording audios and listening locally but I am unable to record audios on online(production server).its showing empty file.recording not happening there.
Please suggest me
my code as follows
protected void btnSaveStop_Click(object sender, EventArgs e)
{
shortPath = Server.MapPath("~/Audios/" + txtTag.Text + ".wav");
formatShortPath = string.Format("save recsound \"{0}\"", shortPath);
mciSendString(string.Format("{0}", formatShortPath), null, 0, 0);
mciSendString("save recsound ", "", 0, 0);
mciSendString("close recsound ", "", 0, 0);
Computer c = new Computer(); c.Audio.Stop();
}modified on Friday, March 12, 2010 1:08 AM
|
|
|
|
|
I found that in my webpage, once the alert messagebox (as follows) is shown then some control styles (such as, location, font size and so on)
are changed in a unexpected way. what is the reason then? anyone suffered this problem before?
Response.Write("<script>alert(sth is here!')</script>");
|
|
|
|
|
I think this is not good practice to write the response. Rather use
this.ClientScript.RegisterStartupScript(this.GetType(), "myscript", "alert('sth is here!')", true);
RegisterStartupScript is there to write javascript output to the client, so why use Response.Write.
|
|
|
|
|
Hi,
The situation is this:
I would like to have an static method in some class of the Models library like this
static User GetCurrentUser()
Which takes a cookie in the user ("currentUserId") and returns the User retrieved from the db..
The problem: I cant have access to the cookies (to the "Request" class) from the Model lib.
So what other solution can I use?
Should I make that method in the Controllers library? IF i dont add a view to a method of a controller class then that method wont be an action?
ALSO: The method needs to be used from other controllers.. so.. is that possible?
|
|
|
|
|
Why dont you use Static Property...
HttpContext.Current.Request.Cookies
This will do the trick...
|
|
|
|
|