|
Hello,
can someone please tell me, if it is possible (and how) to generate a server-generated-error like "HTTP 404 - File not found" or "HTTP 403.4 - Forbidden: SSL is required to view this resource error" from within a asp.net WebMethod call?
All this exception stuff that I tried, produced a "HTTP 500 Internal server error"
best rgds and thanxxx in advance
the-unforgiven
|
|
|
|
|
Help!!!
How do i give write permissios to a folder through code and whenever not needed i can take away the permissions. How 2 achieve this???
|
|
|
|
|
I'm not an expert on this subject but I think that usually it is not possible because changing a folder permissions require special code permissions that the ASP.NET process doesn't have.
Usually if your web application need to write on a folder you must ask the administrator to manually set the write permissions.
If you use a shared hosting probably you have a control panel to set the permissions on the folder.
Consider also that usually for ASP.NET 2.0 the App_Data directory is already configured with the right write permissions (if configured correctly).
Davide
|
|
|
|
|
Yup, sorry, I'm not gonna be much help either.
Try looking at chmod[^]
Hopefully I'm not stering you in the wrong direction
|
|
|
|
|
Simulate a administrator in your csharp code.
|
|
|
|
|
I am using AJAX UpdatePanel for a GridView. The GridView has serveral row commands. Most of the row commands prefer to have the page staying at the same posistion after the command, except one command. That command will display a panel at the top of the page and the user will do something on the panel. It works fine when the list is short because the user can directly see the panel being displayed. However, when the list is very long, it doesn't work well. The reason is when a user click on that row command, the page still stay at the same position because UpdatePanel only does partial page postback. So the panel being display on the top of page won't be seen by the user.
I think, probablly, to use javascript to reset the page position when that row command is clicked, but I don't know how to do it. Could everybody give me some hints, or does anybody have better ideas to do it?
Thanks in advance!
|
|
|
|
|
Hi Everybody,
Thanks for looking at my topic. I'm completely new to C# ASP.NET, so my question might be too easy.
I'm trying to get current values from the row in the DataGrid, that has Field1, Field2 fields.
I'm doing something like this:
string item = (string)((TextBox) e.Item.FindControl("Field1")).Text; on the update button click event.
I do not want to go through the DataTable, just get the current values from the active row in the DataGrid.
Please help me
Thanks a lot.
|
|
|
|
|
zamiran wrote: string item = (string)((TextBox) e.Item.FindControl("Field1")).Text;
You need to pass the name of the Textbox to the Findcontrol function.
string Item = ((TextBox)e.Item.FindControl("txtItem")).Text;
or
string Item = ((TextBox)e.Item.Cells[1].FindControl("txtItem")).Text;
or you can also use
string Item =((TextBox)e.Item.Cells[1].Controls[0]).Text;
|
|
|
|
|
Hi,
thanks for a quick response but I'm doing this
(string)((TextBox) e.Item.FindControl("Field1")) the same as you've suggested but this doesn't help
may be the problem is that the name of the TextBox is wrong, I'm using the caption under the columns. Doe that represent the name of the control.
I also have tried this out, with out of range error every time.
I've tried putting different Cell numbers and Control numbers
string Item =((TextBox)e.Item.Cells[1].Controls[0]).Text;
By the way I can not understand what is Control? Item is initializing the selected row, cell is the textbox, what is Control?
Thanks a lot for you help and patience
|
|
|
|
|
U might have bound the Grid with new values
before the execution of this code.
Can U please send the entire code?
Regards,
Arun Kumar.A
|
|
|
|
|
Hi,
thanks for all your help!
I'm just trying to understand how it all works so, I'm trying to make it simple (IMHO). I want the contents of the cell to be put as a text on Label control on Cancel click event (it doesn't make much sense but, just for the sake of simplicity). Here is the code:
private void missionGrid_CancelCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
try
{
string item = (string)((TextBox) e.Item.FindControl("Field1")).Text; // I do have field called Field1
Label1.Text = item;
}
catch (Exception ex)
{
Label1.Text = ex.Message ;
}
Thanks again
}
The exception error message is this one.
Object reference not set to an instance of an object.
|
|
|
|
|
Hi,
Here you tell that you have a field called "Field1". Is this field is from your database?
If yes then obivously you will not find any control with ID "Field1". Item of your datagrid should contain a control with the ID with which you are finding the control.
So first you put a textbox in the cell with an id lest say "Field1". Then only you will able to find the control and convert it to the TextBox.
Here you are getting NullReferenceException because the code can not find the control with the ID "Field1" or in case it is able to find then it is not able to convert it to the TextBox.
I hope this may help you.
Thanks and Regards,
Chetan Ranpariya
|
|
|
|
|
Hi Chetan,
Here is the way I populate the DataGrid. I thought in this way the textboxes will be called after the DataColumns.
I have the Column Names in my DataGrid named "Field1", "Field2" - but is this different from the control name?
Now I'm totally lost
Thanks for your kind help.
private void Bind()
{
fieldList = new ArrayList();
fieldList.Add("Field1");
fieldList.Add("Field2");
missGridTable = new DataTable();
missGridTable = sp.BindWithFieldList(web,"Test List",fieldList,error); //this brings back table with field names specified in the fieldList array.
missionGrid.DataSource = missGridTable;
missionGrid.AutoGenerateColumns=false;
missionGrid.DataBind();
foreach(DataColumn c in missGridTable.Columns)
{
missionGrid.Columns.Add(CreateBoundColumn(c));
}
missionGrid.DataBind();
}
|
|
|
|
|
Hi,
Can you send the code of CreateBoundColumnd() method?
Thanks and Regards,
Chetan Ranpariya
|
|
|
|
|
zamiran wrote: By the way I can not understand what is Control? Item is initializing the selected row, cell is the textbox, what is Control?
Every column in a row is called a cell. When you try to edit the row in a datagrid, you use controls(like textbox) to edit the data in each cell. To get the data from the controls we access it by using
((Textbox)e.Item.Cells[1].Controls[0]).Text;
This code gets the value of the textbox which is the first control in cell 1 of the selected row in the datagrid
|
|
|
|
|
I have a ASP.NET website that use an HTTP handler (.ashx) to load some images from a database. Like this:
<br />
<img src="Attach.ashx?article=homepage&attach=EucalyptoLogoSmall.png&mode=show" /><br />
I have created an ASP.NET log to report all the errors and I have noticed that sometime I receive from the internet wrong requests.
Basically the request converts the '&' character to '& amp ;' (like an html encoded string).
Like this:
<br />
Attach.ashx?article=homepage& amp ;attach=EucalyptoLogoSmall.png& amp ;mode=show<br />
(I have used the spaces inside the '& amp ;' otherwise this forum convert it to &)
Do you have an idea on how to solve this problem?
Thanks
Davide
-- modified at 11:26 Friday 20th April, 2007
|
|
|
|
|
Perhaps some browser is correcting the url in an unexpected way.
To write the url correctly in the html code, you should use & in the url:
<img src="Attach.ashx?article=homepage&attach=EucalyptoLogoSmall.png&mode=show" />
Try if correcting the code makes the problem go away.
---
single minded; short sighted; long gone;
|
|
|
|
|
Thanks for your response.
You are right I have written a wrong example. Actually I use exactly your syntax. (sorry for the copy and paste bug but I think that the forum has replaced the characters ...).
If you want you can see the real page at www.devage.com .
As you can see the image at the center of the page use the right syntax but I still receive the wrong request from internet.
It is possible that the request came from a search spider or something similar?
Here a line of the log that cause the error:
2007-04-19 09:26:49 W3SVC946387459 80.67.115.122 GET /Wiki/Attach.ashx article=homepage&amp;attach=EucalyptoLogoSmall.png&amp;mode=show 80 - XXX.XXX.XXX.XXX Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.1;+SV1;+.NET+CLR+1.1.4322;+.NET+CLR+2.0.50727) www.devage.com 200 0 0
(I hope that the forum display it correctly)
Seems to be a XP with IE 6 but it is not always the same.
Ideas?
Thanks in advance
Davide
|
|
|
|
|
Hi every one.
I am developing a web application which shows complicated graphs.
The graphs are not simple.
Can any one suggest which graph control is more flexible?
Regards,
Arun Kumar.A
|
|
|
|
|
Hi Arun,
Some of our applications, we have used ChartFX http://www.softwarefx.com/[^]controls and Dundas http://www.dundas.com/[^].
Both are nice tools. Also you can create any test application using both chart controls and check for the memory allocation using any profiler tool and decide which one you need to go for
Thanks
Rakheesh
|
|
|
|
|
Thank U very much.
I will check it out.
Regards,
Arun Kumar.A
|
|
|
|
|
when i was using VS.NET 2005, can't see external classes in one namespase.
In VS.NET 2003 all works.
How can i get access methods & functions of another class in the project.
|
|
|
|
|
In my experience, and to my knowledge, there were no changes to visibility rules between Visual Studio 2003 and Visual Studio 2005. Unfortunately, your post doesn't give us much by the way of details to work with, so let me begin by asking some basic questions:- Is the class that you're trying to access defined in the same assembly, or a referenced assembly?
- Is the namespace for the class that you are trying to access explicitly defined?
- Is the class that you are trying to access in the same namespace? If not, is the namespace referenced with the class or in a
using statement? - Is the class that you're trying to access declared explicitly as
public [or internal for a class in the same assembly]? - Are the members/properties/methods that you're trying to access in the class declared explicitly as
public [or internal for a class in the same assembly]? Hopefully, those will give you an idea of some things to check, and if they don't solve your problem, will give us some better perspective on your situation.
--Jesse "... the internet's just a big porn library with some useful articles stuck in." - Rob Rodi
|
|
|
|
|
YOU WROTE:
>> Is the class that you're trying to access defined in the same assembly, or a
>> referenced assembly?
I'm not shoure, how to check if classes are defined in the same assembly.
>> Is the namespace for the class that you are trying to access explicitly
>> defined?
How can i explicitly define namespace in the project?
>> Is the class that you are trying to access in the same namespace?
Yes, the class i'm trying to access is in the same namespace.
>> Is the class that you're trying to access declared explicitly as public?
Both classes are declared as public.
>> Are the members/properties/methods that you're trying to access in the class
>> declared explicitly as public?
All members are declared as public.
|
|
|
|
|
The easiest way for you to determine if your classes are defined in the same assembly is to verify that they appear in the same Visual Studio project. If your solution contains multiple projects, each project will be compiled into its own assembly. Any classes that you are consuming from an externally referenced .dll are also in a different assembly.
As far as defining a namespace, do you see the namespace keyword at the top of the file? I ask because Visual Studio creates some namespaces when using website projects that produce results that you may not be expecting.
--Jesse "... the internet's just a big porn library with some useful articles stuck in." - Rob Rodi
|
|
|
|