|
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."
|
|
|
|
|
|
That first link is exactly what I was looking for.
Thank you ever so much for saving me bunches of time!
,Gary
|
|
|
|
|
I am using the onClick event to send an email using System.Net.Mail.
It works great. If I add a 'PostBackURL' to the asp button on my form to point to a confirmation page, that works but it breaks the sending of my email.
Is there a way, within my C# code behind, that I can send the user to the confirmation page after the mail sending?
|
|
|
|
|
use response.redirect to send the user to confirmation page after sending email
-----
|
|
|
|
|
Thanks again !!
SABhatti... do you live here(Code Project forums)?
LOL
|
|
|
|
|
nope I live in NY
-----
|
|
|
|
|
I was entering a blog entry in one of our company's web apps, and I got this error when I submitted the post:
A potentially dangerous Request.Form value was detected from the client (_ctl0:cph_Main:_ctl0:_ctl0:postBackBody="...refighter.<br/>
<br/>
Well, ...").
Has anyone every seen anything like this before?
-- modified at 10:28 Monday 26th November, 2007
I deleted the text I thought was creating the problem, because it doesn't seem to matter what I put in there.
-- modified at 10:29 Monday 26th November, 2007
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
John Simmons / outlaw programmer wrote: Has anyone every seen anything like this before?
Yeah. If the user entry the HTML tag in your page, you will get this error..
You can read No.6 as below from my post Some FAQ from ASP.NET web development.
6. Protecting an ASP.NET page against malicious input with ValidateRequest (A potentially dangerous Request.Form value was detected)
When your project is in testing state, you should try to test your application by entering script tag (eg: <script lanague=”javascript”>) or HTML tag (eg: <html><strong>) or #@ or @# characters. And see what happen.. You may probably get the error.. If you don’t wanna get this error then you have to set the page directive validateRequest to false. Note that your page might has the security problem.
Ref: http://codebetter.com/blogs/peter.van.ooijen/archive/2005/10/21/133505.aspex
Hope it helps..
-- modified at 11:14 Monday 26th November, 2007
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."
|
|
|
|
|
It may be that your post included tag symbols < and/or > which are, as the error said, "potentialy dangerous". Try removing them, or replacing with < and > and try again...
You can prevent this by adding a
ValidateRequest="False"
page directive but you should only do this if you trust anyone who is able to post to this page, or else parse their input very carefully...
cheers
fred
|
|
|
|