|
I would like to dynamically change an asp.net web page. This should be done only by an admin and the change should be permanent. I've found alot of tutorials on how to add controls to the same web page, but this was done by everyone and the change was done for the same session and not saved for the next.
|
|
|
|
|
Hi guys how to send multiple attachment files in mail?,
I dont like to assign how many files user can upload...,
In runtime he can upload multiple files
Like Gmail............,
After that have to send mail...,
Plz i searched in net but they fixed for uploading files...,
I want to load multiple files on runtime...,
Thanks & Regards,
NeW OnE,
please don't forget to vote on the post
|
|
|
|
|
Here is a very simple to do it:
SmtpClient client1 = new SmtpClient("smtpserver", 25);
MailMessage msg = new MailMessage();
msg.To.Add(new MailAddress("toemailaddress"));
msg.From = new MailAddress("fromEmailAddress");
msg.Subject = "Test Message";
msg.Body = "Test Mail with Attachments";
Attachment item = new Attachment("D:\\test.txt");
Attachment item1 = new Attachment("D:\\test2.txt");
msg.Attachments.Add(item);
msg.Attachments.Add(item1);
client1.Send(msg);
Response.Write("Send");
Best Regards,
Sam Xavier
www.componentone.com
|
|
|
|
|
Hi All,
I am using basepage in my ASP.Net code but in base page I am not getting session.
My code is as follows:
public class DD_AdmBasePage : System.Web.UI.Page
{
public string LoginUser;
public DD_AdmBasePage()
{
LoginCheck();
}
protected void LoginCheck()
{
if (HttpContext.Current.Session["LoginUser"]!=null)
{
LoginUser= HttpContext.Current.Session["LoginUser"].ToString();
}
else
{
HttpContext.Current.Response.Redirect("~/login.aspx");
}
}
}
please help me, I am getting error in following line:
if (HttpContext.Current.Session["LoginUser"]!=null)
error: object reference not set to an Insatance.
and when i am checking HttpContext.Current.Session, it is showing that it is null. I cant understand why it is null.
Please help me.
Thanks in advance
DAsh04
|
|
|
|
|
ash04 wrote: and when i am checking HttpContext.Current.Session, it is showing that it is null. I cant understand why it is null.
Because you base page has stopped calling "OnInit" on it's base page which is "System.Web.UI.Page". So always override it
public class DD_AdmBasePage : System.Web.UI.Page
{
public string LoginUser;
public DD_AdmBasePage()
{
LoginCheck();
}
protected void LoginCheck()
{
if (HttpContext.Current.Session["LoginUser"]!=null)
LoginUser= HttpContext.Current.Session["LoginUser"].ToString();
else
HttpContext.Current.Response.Redirect("~/login.aspx");
}
protected override void OnInit(EventArgs e) {
base.OnInit(e);
}
}
|
|
|
|
|
thanks navaneeth for participating, I tried but it is not solved my problem. When I checked i found :
protected override void OnInit(EventArgs e)
{ base.OnInit(e); }
this function is not called.
DAsh04
|
|
|
|
|
ash04 wrote: this function is not called.
Then you are doing something wrong. See the ASP.NET page life cycle[^] and "Init" is called at the beginning. Can you post the whole base class code ?
|
|
|
|
|
My full base page code
namespace DD
{
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.SessionState;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
/// <summary>
/// Summary description for DWPage
/// </summary>
public class DD_AdmBasePage : System.Web.UI.Page
{
private string LoginUser="" ;
public DD_AdmBasePage()
{
LoginCheck();
}
protected string PageName
{
get { return HttpContext.Current.Request.Url.Segments[HttpContext.Current.Request.Url.Segments.Length-1]; }
}
public string LoggedInUser
{
get { return LoginUser; }
}
protected void CheckLogin()
{
if (HttpContext.Current.Session["LoginUser"]!=null)
{
LoginUser= HttpContext.Current.Session["LoginUser"].ToString();
}
else
{
HttpContext.Current.Response.Redirect("~/login.aspx");
}
}
protected override void OnInit(EventArgs e)
{ base.OnInit(e); }
}
}
DAsh04
|
|
|
|
|
Can you show your derived Page ?
Are you using OnInit event in that page?
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
Check My Blog
|
|
|
|
|
yes it is like this:
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
InitializeComponent();
base.OnInit(e);
}
private void InitializeComponent()
{
}
#endregion
DAsh04
|
|
|
|
|
Seems to be tricky. Can't guess from this also
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
}
Check this
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
Check My Blog
|
|
|
|
|
Hi all,
can any1 please help...im getting an error "expected '}'" in my javascript here is my function and were i call it
event:
OnClientMouseOver="javascript:MyFunction()"
function:
function MyFunction()
{
document.getElementById("<%=radpnlBarItems.ClientID%>").style.color = "#000066";
}
plz help, thanks in advance
living life on the flip side
|
|
|
|
|
it is may be because value of the code :
radpnlBarItems.ClientID is not comming properly.
DAsh04
|
|
|
|
|
thanks but how will i sort it out?
living life on the flip side
|
|
|
|
|
use it
function MyFunction()
{
alert(<%=radpnlBarItems.ClientID%> );
//document.getElementById("<%=radpnlBarItems.ClientID%>;").style.color = "#000066";
}
DAsh04
|
|
|
|
|
function MyFunction()
{
document.getElementById("<%=radpnlBarItems.ClientID%>").style.color = '#000066';
}
try this
Web Developer
|
|
|
|
|
I've got an issue with dropdownlist.
Basically I display a dropdownlist in a gridview.
In the gridview is a certain amount of rows(lets say 9 for example)
Now the dropdownlist should display an order number for each row.
The dropdownlist should also contain all the other order numbers for the other rows so the user can change it to another order.
The probably Im having is that when the user chooses say order number 8 and the row is currently order number 2 then when it updates the database the number 2 is no longer in the database and is therefore no longer an option in the dropdown, but I need it to be.
What logical way is there to display the number of rows in the dropdownlist and still be able to update the database and see all the numbers for the rows after. The dropdownlist should never contain more then the number of rows available.
Hope this makes sense!
Feel free to ask for more of an explanation.
cheers
|
|
|
|
|
OK ive got the following code:
foreach (GridViewRow row in GridView1.Rows)
{
dropdown = ((DropDownList)row.FindControl("ddorder"));
count++;
dropdown.DataValueField = count.ToString();
dropdown.DataTextField = count.ToString();
dropdown.Items.Add(dropdown.DataValueField);
for (int count2 = 1; count2 <= GridView1.Rows.Count; count2++)
{
dropdown.Items.Add(new ListItem(count2.ToString(), count2.ToString()));
}
}
but the probably is that I need to set the default value of the dropdownlist to a binded value from a database, how woudl I go about doing that?
thanks
|
|
|
|
|
Hi Everyone
I'm writing a web application which has a button(call it "go"), after pressing this button, it has to do some calculations which take some time to be complete, so I want the application to play a "please wait" flash(call it "flash") while it executes, but the flash.play=true; code doesn't help me, the flash starts executing after the application has finished executing, so I tried to do the processing in another thread so that the page will be completed & will be sent to the user, now the "flash" plays properly, but I have another problem, after the execution has been done, I want the user to be redirected to another page, like newpage.aspx, but Response.Redirect("newpage.aspx") generates an error calling "the response is not available in this context." Please help me, what should I do?
|
|
|
|
|
semiramisContraA wrote: so I tried to do the processing in another thread
This may be the cause
Use
System.Web.HttpContext.Current.Response
EVEN THE WORD IMPOSSIBLE SAYS I M POSSIBLE.
|
|
|
|
|
One way is to use Ajax.
but if you need the functionality in only this page then no need of Ajax.
Do it at client side instead of server
When user click go button show image in the div tag using javascript.
And at the back you can have the same functionality that yo are doing.
I think this easy to impliment also
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
Check My Blog
|
|
|
|
|
Thank you for your answer, but will you please explain more?
|
|
|
|
|
i want to convert the any video file into .flv format.. it is worked local server perfectly.. but it is not worked in web server... security exception will be displayed.. i used ffmpeg.exe tool only... pls help me
Process ffmpeg; // creating process
string video;
string mpg;
video = Page.MapPath("movie.wmv");
mpg = Page.MapPath("") + "\\video.flv"; // thumb name with path !
ffmpeg = new Process();
ffmpeg.StartInfo.Arguments = "-i " + video + " -f flv -vcodec flv -qscale 10 -s 480x360 -ar 44100 -acodec libmp3lame " + mpg; // arguments !
ffmpeg.StartInfo.FileName = Page.MapPath("ffmpeg.exe");
ffmpeg.Start();
|
|
|
|
|
Is the tool you are using a third party tool?
What is the exact error messagr you are recieving?
|
|
|
|
|
i receive this error
Security Exception
Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.
Exception Details: System.Security.SecurityException: Request failed.
Source Error:
[No relevant source lines]
Source File: App_Web_1lwzeoop.0.cs Line: 0
Stack Trace:
[SecurityException: Request failed.]
_Default.Button1_Click(Object sender, EventArgs e) +0
System.EventHandler.Invoke(Object sender, EventArgs e) +0
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +107
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +7350
System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +213
System.Web.UI.Page.ProcessRequest() +86
System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +18
System.Web.UI.Page.ProcessRequest(HttpContext context) +49
ASP.default_aspx.ProcessRequest(HttpContext context) in App_Web_1lwzeoop.0.cs
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +358
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +64
|
|
|
|