|
DataRow drow ;
drow = dtloc.NewRow();
drow["locname"] = ((TextBox) tx).ID;
drow["locval"] = ((TextBox) tx).Text;
dtloc.Rows.Add(drow);
|
|
|
|
|
Maybe I missed it, but was there a question in there? My eyes start to burn when they see Visual Basic code.
--Jesse "... the internet's just a big porn library with some useful articles stuck in." - Rob Rodi
|
|
|
|
|
Jesse Squire wrote: Maybe I missed it, but was there a question in there?
Your eyes are fine (I think). I didn't see a question in there either.
|
|
|
|
|
|
Wow - I only saw his first post, at the bottom of a page. It's worst than I thought. That's an awesome link tho, I've bookmarked that for future reference.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
What did you expect this to do ? You're incrementing n outside your while loop, so it looks likely to me that it will loop forever. Your SQL is ripe for injection attacks. I don't see how this can work at all, or at least, how it can do anything.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
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
|
|
|
|