Web Forms :: Read Client Side Text File?
Mar 12, 2010I have to read a client side ini file in Aspx page and use that data in server side processing. refer to a link or any sample if possible.
View 6 RepliesI have to read a client side ini file in Aspx page and use that data in server side processing. refer to a link or any sample if possible.
View 6 RepliesI have to read the first couple of lines of a csv file client side to present the user with a preview before uploading a large file.
I'm using c# with ASP.Net (VS2010)
Does anyone know how this can be done? Also that it works in all browsers!?!
(It's not possible to use activeX or so, we do not want our clients to install something!)
I have a project of ASP.NET which is a Customer satisfaction Survey, i need to to incorporate the option selected by customer with the a client side text file which i located at the client machine, read a text file on client or should i develop the survey application as window application.
View 7 RepliesIn ASP.Net, I want to give a user an ability to save the text entered in the textbox to the client machine. So that, user can copy paste it for later use.
Is there a way to show, save as dialog so that user can save the text in a text file on client machine? or, if there is any other alternative?
I need to save a text file on the client side possibly without permission. The case is that I need to save this text file in a shared folder in this or in another machine in the lan. This text file is going to be read automatically by the fiscal printer which will print the fiscal invoice. I have a asp .net web application and the server is not on the same lan with the fiscal printer, so I have to write it on the client-side. how to do this without asking to the user every time for the security issue.
I can accept a solution like, the client is asked only one time a the first printing, but not every time he wants to print a bill. Some kind of asking permission to the client for allowing this website, in order to not repeat the permission asking.
I've got two textboxes running server side and have their visibility turned off. I'm using a couple of ASP.NET controls which require the textboxes to exist. However, I am filling them from the code behind and would not like the user to see this. Can the user turn the visibility on and see the values entered in the text box? I tried using FireBug, and I couldn't seem to select the visibility option in order to edit it. However, I'm quite new to Firebug, so there may be another way? Or does running it server side mean that the client can't ever view the contents of the textbox?
View 1 RepliesIf I have a standard HTML textbox
[Code]....
but got a readonly error.
I have a treeview which showcheckbox=true, when the checkbox is ticked I need to run a js function on client side and read the value of the checkbox
I set the treeNode1.value=i
In IE, I can get the value of each check box (which is i...)
but in chrome, firefox and safari, the value is always "On"
If I have a standard HTML textbox: I can retrieve the value using Request.Form. But how do I go about populating this textbox from the server-side? I tried Request.Form["txtTest"] = "blah"; but got a readonly error.
View 2 RepliesI have a content-sensitive firewall between my clients and my server. If we exclude SSL solution (it's not available in my case) then I was thinking of a javascript library which encrypts custom fields at client-side and a .NET class decrypts them at server-side. Is there any solution out of the box (maybe a server control) ?
View 2 RepliesASP.NET newbie question - fastest fingers!
I have a page that needs to pull some script off the server, including tag info, for the page. Thus:
<html><body>
blahblahblah
<%: Model.TaggedField %>
</body></html>
Problem is, the value of Model.TaggedField may include HTML tags, but the page automatically converts the tag info to <myTag> etc.
What method can I call to make the value of Model.TaggedField be transmitted verbatim to the page?
How can I read a file from client's pc? I found out that it required to upload the file to server and read it from the server, what if I want to read it directly from client's pc, can I do that
View 4 RepliesI have a ModalPopup panel which can be brought up from various different textboxes on my WebForm. In JavaScript when I being up the ModalPopup I set a label.InnerHtml value. That displays the label properly on the screen, but then when I try to read the label's text property in the codebhind, it is the initial value it was. How can I get such a value to be propgated over to the server?
View 3 RepliesTo my understanding the clinet side can only send data to the server either by get or post. so basically either through query string (get) or through body of the page (post).
So when we upload a file from client machine and send it to server, what exactly is happening behind the scenes? are we doing a post?
I'm new to ASP.net 3.5 and testing functionality before developing an asp.net web site. I created a page with a formview. I added several text boxes. I created an event on the FirstName_TextChanged event and added a stop in the sub. When I open the page in the browser and type in some text in the FirstName and press tab, nothing seems to fire.
1) Is this supposed to fire on the client side when text is changed?
2) If so, would the vb.net code entered work like Javascript code on the server?
3) If so again, is it possible to update another textbox based on the text entered into the FirstName on the Client Side (would do this in Javascript in Classic ASP)?
I think I'm totally confused. I've been searching web for article about how to do this.
I have a textbox where data will be entered by user without any postback. I need to add the data to a variable or any hidden variable or i need to store data from all the controls on th epage in which user entered to a variable this controls in which user enters the data becomes visible on button click i mean a post back happen...
View 1 RepliesI have developed an application where I need to create a page to read data from Excel File and then update it to the database. The code that I wrote works only when the application runs from my machine. When I deployed the application to the server it gave an error- 'C:PRFileIimport_File.xls' is not a valid path. Make sure that the path name is spelled correctly and that you are connected to the server on which the file resides. here is mu code -
protected void InsertData(object sender, EventArgs e)
{
OleDbConnection oConn = new OleDbConnection
(@"Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\PuertoRicoFile\Puertorico_Iimport_File.xls ; Extended Properties=Excel 8.0 ");
OleDbCommand oCmd = new OleDbCommand("select * from [Puertorico_Data$]", oConn);
oConn.Open(); //Here [Puertorico_Data$] is the name of the sheet in the Excel file where the data is present
OleDbDataReader oleDbReader = oCmd.ExecuteReader();
string AgentIP = "";
string TagName = "";
string Status = "";
string Severity = "";
int EventCount = 0;
string EarliestEvent = "";
string LatestEvent = "";
while (oleDbReader.Read())
{
AgentIP = (string)oleDbReader[0]; // valid(oleDbReader, 0);//Here we are calling the valid method
TagName = (string)oleDbReader[1]; //valid(oleDbReader, 1);
Status = (string)oleDbReader[2]; //valid(oleDbReader, 2);
Severity = (string)oleDbReader[3]; //valid(oleDbReader, 3);
EventCount = Convert.ToInt32(oleDbReader[4]); //oleDbReader[0]; //valid(oleDbReader, 4);
EarliestEvent = (string)oleDbReader[8]; //validate(oleDbReader, 8);
EarliestEvent = EarliestEvent.Substring(0, 19);
LatestEvent = (string)oleDbReader[9]; //validate(oleDbReader, 9);
LatestEvent = EarliestEvent.Substring(0, 19);
InsertDataIntoSql(AgentIP, TagName, Status, Severity, EventCount, EarliestEvent, LatestEvent);
}
SqlConnection mySQLconnection = new SqlConnection(ConfigurationManager.ConnectionStrings["IssNetworkReportingSystemConnString"].ConnectionString);
mySQLconnection.Open();
SqlCommand cmdSql = new SqlCommand("AddMonth_Event_TotalInfo_for_Puertorico", mySQLconnection);
cmdSql.CommandType = CommandType.StoredProcedure;
dbReader = cmdSql.ExecuteReader();
dbReader.Close();
cmdSql = new SqlCommand("AddQtr_Event_TotalInfo_for_Puertorico", mySQLconnection);
cmdSql.CommandType = CommandType.StoredProcedure;
dbReader = cmdSql.ExecuteReader();
dbReader.Close();
oConn.Close();
lblMsg.Text = "Data Imported Sucessfully";
lblMsg.ForeColor = System.Drawing.Color.Green;
}
public void InsertDataIntoSql(string agentIP, string tagName,
string Stat,string severity,int eventCount, string eEvent, string lEvent)
{//inserting data into the Sql Server
SqlConnection mySQLconnection = new SqlConnection(ConfigurationManager.ConnectionStrings["IssNetworkReportingSystemConnString"].ConnectionString);
mySQLconnection.Open();
SqlCommand sqlSelect = new SqlCommand("SELECT SeverityID from Severity where SeverityDesc=@SeverityDesc",mySQLconnection);
sqlSelect.CommandType = CommandType.Text;
sqlSelect.Parameters.Add("@SeverityDesc", SqlDbType.NVarChar).Value = severity;
dbReader = sqlSelect.ExecuteReader();
int severityId = Convert.ToInt32(dbReader.Read());
dbReader.Close();
SqlCommand sqlInsert = new SqlCommand("Insert into IdsData_Puertorico(AgentIP,TagName,Status,SeverityID,EventCount,EarliestEvent,LatestEvent)" +
" values (@AgentIP,@TagName,@Status,@SeverityID,@EventCount,@EarliestEvent,@LatestEvent )" ,mySQLconnection);
sqlInsert.CommandTimeout = 0; //timeout unlimited
sqlInsert.CommandType = CommandType.Text;
sqlInsert.Parameters.Add("@AgentIP", SqlDbType.NVarChar).Value = agentIP;
sqlInsert.Parameters.Add("@TagName", SqlDbType.NVarChar).Value = tagName;
sqlInsert.Parameters.Add("@Status", SqlDbType.NVarChar).Value = Stat;
sqlInsert.Parameters.Add("@SeverityID", SqlDbType.Int).Value = Convert.ToInt32(severityId);
sqlInsert.Parameters.Add("@EventCount", SqlDbType.Int).Value = Convert.ToInt32(eventCount);
sqlInsert.Parameters.Add("@EarliestEvent", SqlDbType.DateTime).Value = DateTime.Parse(eEvent);
sqlInsert.Parameters.Add("@LatestEvent", SqlDbType.DateTime).Value = DateTime.Parse(lEvent);
sqlInsert.CommandType = CommandType.Text;
sqlInsert.ExecuteNonQuery();
mySQLconnection.Close();
}
I have an input type, so a text box which has a browse button next to it. When it is clicked, the file that is selected has it's full path placed into the text box.
<input type="file" runat="server" id="txtFilename" style="width:400px" />
Where is the event! Now that I have the path to the file in the textbox of the input type, I want to load each line of this file into a textbox that is able to handle multiline text. I don't want the file to be uploaded to the website. I just want to contents of the file read and placed in a textbox all with one click on the browse button.
How to read a .doc file from as a string in asp.net page to a literal control without format loose and to display images also.
Is it possible to read .pdf as above.
I have a user control which contains a CustomValidator which is used according to whether a RadioButton is checked or not (there are several RadioButtons, I'm only showing the relevant one)
<asp:RadioButton runat="Server" ID="RadioBetween" GroupName="DateGroup" CssClass="date_group_options_control_radio" />
[code]...
There is some client + server side validation code (the server side code does exactly the same thing and is skipped for brevity)
<script type="text/javascript">
function ValidateDateFields_Client(source, args) [code]...
There are two instances of this control in the page. When running the client side version it hits the wrong one (the version of the control which is disabled). You can see from the generated HTML both are correctly specified. I'm not sure how .NET works out which clientside function to call given they both have the same name.
<script type="text/javascript">
//<![CDATA[
var ctl00_MCPH1_QueryTextValidator = document.all ? document.all["ctl00_MCPH1_QueryTextValidator"] : document.getElementById("ctl00_MCPH1_QueryTextValidator");
[code]...
Do i need to add something in to scope it? What's the best way to achieve this? If I disable the loading of the second control everything works fine.
im tryin to upload files to the database using the FileUpload. the upload take place. when i download the file again ( word document, excel document.. a text document (.txt), a winzip file) , it turns that the file is corrupted and cannot be opened.. an image file or an mp3 file doesnt present this problem. my application is developped usin vb.net 2010 and sql server 2005 as the database..
[Code]....
[Code]....
I found some code that looks like it will do what I want to do, but the code doesn't work.
[Code]....
The error seems to occur here: mytext.txt
Error Message is: unrecognized escape sequence
I think somehow the syntax with StreamReader is not quite right.
I did something similar in VB and it worked fine. I'm just beginning to learn C#; it's going to be a little while before the training wheels come off.
I have a form that contains a TextBox. A pop up window will return a value and put it into the TextBox. when this happens, i need to populate another control. I tried "OnChange" but it was not triggered .
View 1 RepliesI am trying to add a client side event to a dropdownlist and I need to access the currently selected Text. I have tried:
ddl_tech.Attributes.Add("onclick", "document.getElementById('" + chk_techreview.ClientID + "').disabled = this.options[this.selectedIndex].text.Equals(' UNASSIGNED');");
and
ddl_tech.Attributes.Add("onclick", "document.getElementById('" + chk_techreview.ClientID + "').disabled = this.text.Equals(' UNASSIGNED');");
Both of which give me runtime errors when the event is fired.Whats the correct way to access this text property client side?I tried this but it does not enable the checkbox...
ddl_tech.Attributes.Add("onchange", "document.getElementById('" + chk_techreview.ClientID + "').disabled = this.options[this.selectedIndex].text == ' UNASSIGNED';");
ANSWER:
Well, along with having to use == rather than .Equals, when you set a checkbox.enabled = false on the server side it raps the checkbox in tags and sets it to disabled=true; therefore you must set BOTH the checkbox.disabled = false and checkbox.parentElement.disabled = false; on the client side to enable the checkbox!The solution:
ddl_tech.Attributes.Add("onchange", "document.getElementById('" + chk_techreview.ClientID + "').parentElement.disabled = (this.options[this.selectedIndex].text == 'UNASSIGNED'); document.getElementById('" + chk_techreview.ClientID + "').disabled = (this.options[this.selectedIndex].text == 'UNASSIGNED');");
I have a radio button list. I want to get its selected item text and value client side suing javascript...
View 1 Replies