|
ankitjain1110 wrote: sb.Append( "
replace this with
sb.Append( "<script language=""JavaScript>""" );
HTH
<div class="ForumSig">Coding C#
<a href="http://www.excitetemplate.com">ExciteTemplate</a></div>
|
|
|
|
|
its still not working.the errors are
Error 1 ) expected C:\Users\Ankit\Documents\Visual Studio 2005\WebSites\WebSite1\Default2.aspx.cs 93 37 C:\...\WebSite1\
Error 2 ; expected C:\Users\Ankit\Documents\Visual Studio 2005\WebSites\WebSite1\Default2.aspx.cs 93 50 C:\...\WebSite1\
Error 3 ; expected C:\Users\Ankit\Documents\Visual Studio 2005\WebSites\WebSite1\Default2.aspx.cs 93 53 C:\...\WebSite1\
Error 4 Invalid expression term ')' C:\Users\Ankit\Documents\Visual Studio 2005\WebSites\WebSite1\Default2.aspx.cs 93 53 C:\...\WebSite1\
|
|
|
|
|
sb.Append( "" );
Try this
<div class="ForumSig">Coding C#
<a href="http://www.excitetemplate.com">ExciteTemplate</a></div>
|
|
|
|
|
no this way it doesnt work.its popping up some new errors.like messagebox doesnt exists.
actually i tried out the code given @
Simple MessageBox functionality in ASP.NET[^]
ohers have replied its workin fine..so where am i going wrong
|
|
|
|
|
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 System.Data.OleDb;
using System.Text.RegularExpressions;
using System.Text;
public class MessageBox : System.Web.UI.Page
{
private static Hashtable m_executingPages = new Hashtable();
private MessageBox(){}
public static void Show( string sMessage )
{
// If this is the first time a page has called this method then
if( !m_executingPages.Contains( HttpContext.Current.Handler ) )
{
// Attempt to cast HttpHandler as a Page.
Page executingPage = HttpContext.Current.Handler as Page;
if( executingPage != null )
{
// Create a Queue to hold one or more messages.
Queue messageQueue = new Queue();
// Add our message to the Queue
messageQueue.Enqueue( sMessage );
// Add our message queue to the hash table. Use our page reference
// (IHttpHandler) as the key.
m_executingPages.Add( HttpContext.Current.Handler, messageQueue );
// Wire up Unload event so that we can inject
// some JavaScript for the alerts.
executingPage.Unload += new EventHandler( ExecutingPage_Unload );
}
}
else
{
// If were here then the method has allready been
// called from the executing Page.
// We have allready created a message queue and stored a
// reference to it in our hastable.
Queue queue = (Queue) m_executingPages[ HttpContext.Current.Handler ];
// Add our message to the Queue
queue.Enqueue( sMessage );
}
}
// Our page has finished rendering so lets output the
// JavaScript to produce the alert's
private static void ExecutingPage_Unload(object sender, EventArgs e)
{
// Get our message queue from the hashtable
Queue queue = (Queue) m_executingPages[ HttpContext.Current.Handler ];
if( queue != null )
{
StringBuilder sb = new StringBuilder();
// How many messages have been registered?
int iMsgCount = queue.Count;
// Use StringBuilder to build up our client slide JavaScript.
//sb.Append( "<script language=""(JavaScript)""" );
sb.Append("<script language="'JavaScript'">");
//sb.Append("<script language=\"javascript\">");
// Loop round registered messages
string sMsg;
while( iMsgCount-- > 0 )
{
sMsg = (string) queue.Dequeue();
sMsg = sMsg.Replace( "\n", "\\n" );
sMsg = sMsg.Replace( "\"", "'" );
sb.Append( @"alert( """ + sMsg + @""" );" );
}
// Close our JS
sb.Append( @"</script>" );
// Were done, so remove our page reference from the hashtable
m_executingPages.Remove( HttpContext.Current.Handler );
// Write the JavaScript to the end of the response stream.
HttpContext.Current.Response.Write( sb.ToString() );
}
}
}
this is my code.its showing error.too many characters in character literal
|
|
|
|
|
Hi,
My interface is having One, dropdownlist, some text boxes, one fileupload and a submit button..
code here..
<asp:panel id="Group1" runat="server">
<asp:dropdownlist autopostback="true" id="drp_Category" cssclass="textboxGQ_New" width="200px"
="" runat="server" onselectedindexchanged="drp_Category_SelectedIndexChanged">
<asp:listitem value="">Select Category
<asp:listitem value="Category1">Category1
<asp:listitem value="Category2">Category2
<asp:listitem value="Category3">Category3
<asp:listitem value="Category3">Category4
<asp:requiredfieldvalidator validationgroup="Group1" id="Req_drpCategory" display="None"
="" controltovalidate="drp_Category" runat="server" errormessage="Enter Category">
<cc1:validatorcalloutextender id="VCE_Category" targetcontrolid="Req_drpCategory" runat="server">
For file upload code...
------------------------
<asp:fileupload id="FileUpload1" cssclass="textboxGQ" runat="server" type="file" onkeypress="return false;">
<asp:customvalidator id="Req_FileUpload1" runat="server" errormessage="Please select file to upload"
="" controltovalidate="FileUpload1" onservervalidate="validatedrp">
<cc1:validatorcalloutextender id="Req_FileUpload1_Extender" runat="server" targetcontrolid="Req_FileUpload1">
Code behind
===========
protected void validatedrp(object source, ServerValidateEventArgs args)
{
if (drp_Category.SelectedValue == "Category1")
{
args.IsValid = true;
}
else if(drp_Category.SelectedValue == "Category3")
{
args.IsValid = true;
}
else if(drp_Category.SelectedValue == "Category2")
{
args.IsValid = false;
}
else if(drp_Category.SelectedValue == "Category4")
{
args.IsValid = false;
}
}
My issue is if i select dropdownlist item Category1 or Category3 and click the submit button, the fileupload should prompt msg as "plz select file to upload"....if i select dropdownlist item Category3 or Categroy4 and click the submit button, the fileupload should not propt msg and should redirect to different page...
plz help..
Thanks in advance
|
|
|
|
|
Change ControlToValidate attribute of the custom validator from "FileUpload1" to "drp_Category"
|
|
|
|
|
I am not able to add rows n values to data gridview programmatically(without binding to datasource)..I think the problem is because the rows are assigned 'databound' property...Any alternative for 'databound' so that i can add values programmatically?
|
|
|
|
|
Hi,
if (FileUpload1.HasFile == true)
{
FileUpload1.SaveAs(Server.MapPath("~/AdminSection/Attachment/Emp/" + FileUpload1.FileName.ToString()));
}
If file is not blank, then this code work fine.
but if the file is blank then it doesn't.
Is there any Solution for this.
or tell me how to check whether file (File can be of any type) is blank or not.
Thanx.
|
|
|
|
|
Priyagdpl wrote: or tell me how to check whether file (File can be of any type) is blank or not.
Check FileUpload1.FileBytes.Length or FileUpload1.FileContent.Length for validating the file size.
|
|
|
|
|
Really Thanx...
Its Work Fine...
|
|
|
|
|
i use AJAX calender extender in my webbased project when i run this project it show exception. How do i clear this exception?A ScriptManager is required on the page to use ASP.NET AJAX Script Components.
|
|
|
|
|
haleemasher wrote: A ScriptManager is required on the page to use ASP.NET AJAX Script Components.
Read the exception.Place ScriptManager in the page.Drag and Drop ScriptManager from the toolbox to the top of the page.
|
|
|
|
|
I forget to add this code in aspx file now its working. Thread end here
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
|
|
|
|
|
Hi guys...,
I am trying to show advertisement page in my site...,
i have more than one image using adrotator control i am displaying it in alternatively...,
now my clients giving script files...,its possible to show the script files also using the adrotator control?,
if its not possible give me some other way...,
how to achieve it...,
Thanks & Regards,
Member 3879881,
please don't forget to vote on the post
|
|
|
|
|
|
Hi guys...,
I am trying to show advertisement page in my site...,
i have more than one image using adrotator control i am displaying it in alternatively...,
now my clients giving script files...,its possible to show the script files also using the adrotator control?,
if its not possible give me some other way...,
how to achieve it...,
Thanks & Regards,
Member 3879881,
please don't forget to vote on the post
|
|
|
|
|
|
Hi All,
I have a requirement from one client to change the sessionid for each user to avoid session hijacking.
So i did that as suggested by below link.
http://palisade.plynt.com/issues/2007Feb/asp-session-cookies/
Now they asking to binding the session id to the client machine ip.
My application developed using classic ASP.
How can i achieve that, please help me....
|
|
|
|
|
What is the problem with this. Each computer generates its own session with different session id.
If you want to allow the IP based authentication including user id and password, so that the user id is not valid in any other computer, try to store the IP in the user table, and check whether the call is from the same client.
|
|
|
|
|
thanks for your reply...
I have implemented using following steps.
1) i have create one more database table to store clientip and aspsessionid...
2) Create the function to store ASPSessionid and client ip to the table when user logged in successfully
3) Create the function called "validateUserSession()" to Validate sessionid and clientid
4) Whenever user requesting the authenticated page i am calling function "validateUserSession" with current sessionid and clientip
5) if the record exists in the table login success otherwise failed
is that correct approch..
|
|
|
|
|
Hi,
I am using C# and i am new to it. My requirement is I am using Stored procedure for all insert/update. When calling a storedprocedure I need to send parameters to it. Now problem is i am having nearly 80 to 100 parameters in each form and I feel it is cumbersome to add in each form that many no of parameters manualy.
Is there any function/routine to read the parameters from the properties and add it to the stored procedure and make a commad text?
has any one tried it .. please share ..
regards
|
|
|
|
|
Try passing it as xml and use OPENXML in SQL query to process that.
|
|
|
|
|
Hi Arun
any sample code you have ..if so please share with me .
|
|
|
|
|