|
|
Do not repost the same question if no one answers the first time. This is the same thing you just asked. Reposting same question is also considered rude.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
|
|
|
|
|
I have a form with some read-only TextBox controls on it.
<asp:TextBox ID="Total1" ReadOnly="true" maxlength="2" columns="1" runat="server" />
These controls are being populated by a javascript function as the user enters data elsewhere on the form. When I try to read these values after the user clicks the submit button with this code:
int x = Convert.ToInt32(this.Total1.Text);
the Text property shows "0", despite showing another value on the screen. If the javascript can set the text on the screen, why doesn't the .Net code read the correct value from the control?
What am I doing wrong?
"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
|
|
|
|
|
use
ContentEditable="false"
insted of Readonly property, if you use ReadOnly="true" it lost data when postback.
I have faced same problem and i have that solluation
let me know when done
|
|
|
|
|
I found another solution as well:
Create this class:
using System;
using System.Data;
using System.Configuration;
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;
namespace MyWebControls
{
public class TextBox : System.Web.UI.WebControls.TextBox
{
public override bool ReadOnly
{
get
{
return false;
}
set
{
if (value)
{
this.Attributes.Add("readonly", "readonly");
}
else
{
this.Attributes.Remove("readonly");
}
}
}
}
}
Add the following to your web.config:
<system.web>
<pages>
<tagMapping>
<add tagType="System.Web.UI.WebControls.TextBox" mappedTagType="MyWebControls.TextBox"/>
</tagMapping>
</pages>
</system.web>
But I'll give your thing a go because that is a lot lower effort.
"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
|
|
|
|
|
Greate Idea.
I have one more solluation ..... just Readonly the text box when page load and Flase it when postback
|
|
|
|
|
amazing solution.. I also faced that problem with panel control.
|
|
|
|
|
The ContentEditable property does not exist for asp:TextBox (at least, not in .Net 2.0).
"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: The ContentEditable property does not exist for asp:TextBox (at least, not in .Net 2.0).
Yes it does not exist .. But It Support !!!
Did you try this one ? . You will get a warning but your problem will solve.
|
|
|
|
|
It's generally not advisable to use undocumented functionality (and I don't allow compiler warnings in any of my code). I think I'll stick with the property overload.
"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
|
|
|
|
|
If the Design/ASPX view of Visual Studio is complaining of the error, you can actually emit the property and its associated value using .Attributes.Add from the CodeBehind.
Vasudevan Deepak Kumar
Personal Homepage Tech Gossips
A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis Levinson
|
|
|
|
|
Read through the scenario.
client A wants to read files from another client B present in the same network. But this reading should be done through a ASP.NET web application . In other words a client should be able to read a text file present on another client in the same network.
This scenario would be applicable in an intranet application. The thing to note is that the path of client B would be present in the server. The client A would pick the path from the server and navigate automatically to client B, hunt down the necessary folder and read the text files and store the necessary data in a database.
Here is the code on which I am working
protected void Button1_Click(object sender, EventArgs e)<br />
{<br />
DataTable dt = new DataTable();<br />
<br />
<br />
StreamReader sr = new StreamReader(@"\\Pc4\C$\NDP\Test1.csv");<br />
string line;<br />
while((line = sr.ReadLine()) != null)<br />
{<br />
Label1.Text += line;<br />
<br />
<br />
}<br />
<br />
}
The client A when he executes this code is intending to access another client B (Here it is PC4 in the same domain).
The code resides on server in Win 2K3 box.
I have identity impersonate="true" in web.config. In the Directory security I have Anonymous Access and Windows Authentication turned on.
So the basic flow is
Client A User requests through browser an aspx file residing on the server. On the form provided by the aspx file he clicks on the button to open a file in a location specified in the above mentioned code. This location is present on a machine (named PC4) which belongs in the same domain as client A. The NDP folder mentioned in the path is also shared and contains access permissions for user account who is making request as client A.
When I click on the button, it gives me a HTTP 404 error - stating File or Directory not found.
In the address bar I get to see
http://192.168.0.1/abtsweb/Genericerrorpage.htm?aspxerrorpath=/abtsweb/readingtextfile.aspx
Now what should be done in this case.
|
|
|
|
|
Hi,
I too worked on this where in Web.config file I gave identity impersonate="true" username="MY ID" password="PASSWORD"
|
|
|
|
|
Thanx a lot. It worked.
|
|
|
|
|
hi,
here is my code..
<asp:imagebutton id="ImageButton1" imageurl="~/reset_btn.gif" postbackurl="google.com" runat="server">
i want to go to google.com when i click on image button.
but iam getting an error with the above code....
error:The HTTP verb POST used to access path '/linkexample/google.com' is not allowed.
after clicking on image button url for page is like this..
http://localhost:2578/linkexample/google.com"
thanks in advance
siri
|
|
|
|
|
|
hi,
here is my code..
<asp:imagebutton id="ImageButton1" imageurl="~/reset_btn.gif" postbackurl="google.com" runat="server">
i want to go to google.com when i click on image button.
but iam getting an with the abve code....
error:The HTTP verb POST used to access path '/linkexample/google.com' is not allowed.
after clicking on image button url for page is like this..
http://localhost:2578/linkexample/google.com"
thanks in advance
siri
|
|
|
|
|
sirisha guttikonda wrote: <asp:imagebutton id="ImageButton1" imageurl="~/reset_btn.gif" postbackurl="google.com" runat="server">
try with this
postbackurl="http://www.google.com"
|
|
|
|
|
Write
Response.Redirect("http://www.google.com");
in the click event of that image.
krishna veer singh
|
|
|
|
|
|
Hi,
I m newbiew to Asp.net(vb).
I have a menu control which include some items like Home,Search etc.
The Search Item have some subitems.The problem is that the dynamic part(subitems of search) of menu is hided by another control which is just placed under of menu control,
I want to show it just like Message Boards of Code Project(See Above) it shows its subitem above all the controls.
I hope someone will understand my problem and help me to solve it
Looking forward for your response, Thans with anticipation
|
|
|
|
|
I am doing an application in asp.net with C#. And here i am using the xml files which should to be read at different node types.
And i am requested to do this using Xquery.
So i have downloaded the DataDirectXQuery in my system.
Now can anybody help me how to use this xquery in my webform.
or Is there anyother way to fetch the xml files dynamically.
VanithaVasu
|
|
|
|
|
Have my web application...Install it using the .msi
When I try to open the project(.csproj/.vbproj)
Get the message box asking for conversion from VS2003 to VS 2005.
Follow the steps..... you reach a screen which says "do wish to take back up (Yes or No)"
If I select YES and once the code has finished conversion, I try to compile the same..
I am not able to do so as it gives following error message:
"It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS. "
I have configured the virtual directory and also done the required settings to set it as an application in IIS.
If I do not take the back up and proceed the conversion, I am able to compile it without any errors.
Has anyone else faced with similar issues. Any help will be apreciated
|
|
|
|
|
This error occurs when the compiler finds a web.config file with MachineToApplication settings that is not in the application's root folder.
Check where you are storing the backup. If it is in a subdirectory under your website, move it somewhere else so you don't confuse the compiler.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
The query is working properily in sql Query Analyser, But i am not getting a +VE value after executing this particular code
Plz help
con.Open();
SqlCommand scmd = new SqlCommand("select employee_id from shift_assign where monthh="+ViewState["monthh1"]+" and yearr="+ViewState["yearr1"]+"",con);
int y=scmd.ExecuteNonQuery();
|
|
|
|