I have an asp gridview that I am exporting to Excel. The data exports perfectly except for fields that are text fields with leading zeros. I have a field in the data grid for job number that has leading zeros. When that data is exported to Excel 000564 gets exported as only 564.Is there DataFormatString expression that I can use that will force that column to be exported to Excel as text.I have also thought about changing the SQL statement to so the job number is definitely a string by concatenating using ‘J’ + jobnumber as JobNumber but my users don’t want a ‘J’ in front of the job number.Is there a DataFormatString expression for a text string?
I have an old database that still contains depreciated Text fields. I need to pull from these fields and display the results. You would think this should be easy... First my select statement caused a problem:
Code: SELECT DISTINCT ..., CustomerInstructions, ... FROM Orders where CustomerInstructions is a Text field.
The error I get: "The text data type cannot be selected as DISTINCT because it is not comparable." A quick search shows I can cast the text field as a varchar(max).
Code: SELECT DISTINCT ..., CAST(CustomerInstructions AS VARCHAR(MAX)), ... FROM Orders
Now I get an error while trying to load the instructions into a text box: "Specified argument was out of the range of valid values. Parameter name: index"
Not sure what the problem is here. I have text and a text box. What's with the "out of range" crap?
I have in my database the News Table which consist of => Id, Title, txt . I need to be able to get a description text from the whole text which exist in txt Field , but without any codes like <...> , just a pure text !! how can I do this?
I'm trying to read the contents of a text file into a text box on my form. When I run the following code, nothing happens.
VB.NET Code: Protected Sub lbLogs_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs) Handles lbLogs.SelectedIndexChanged    For Each li As ListItem In lbLogs.Items      If li.Selected Then        Using sw As New StreamReader(li.Value)          txtLog.Text = sw.ReadToEnd           sw.Close()        End Using      End If    Next  End Sub
I populate the ListBox with ListItems and each ListItem's Value property holds the full path to the file. But, I removed all of that and just put txtLog.Text = "test" inside of the "is selected" block.
I have set up an SQL 2005 DB with a TimeDate column. I put a date in (UK - dd/mm/yyyy) and to shows "18/04/2010 00:00:00" Fine not a problem here. When I come to format the Data in my gridView it sets the Month to "00" all the time!
I have a DataboundField in a grid. I'm trying to display a date in Euro format and the time. The time should be wrapped in a span with a css class applied to it.
I am using this, DataFormatString="{0:dd/MM/yyyy <span class='tinyDate'>hh:mm:ss</span>}"
It's actually pretty close, except the span tag is literally rendering in the browser.
In the cell the text looks like this
19/10/2010 <span class=tinyDate>09:35:00</span>
I don't intend to see the span tag, only it's formatted content. How can I remedy this and make it render correctly?
I have a gridview that I am populating with data for the folks in accounting and they want me to format currency values so that they display without $'s, with commas separating digits and with negative numbers surrounded by ( )
e.g.:
12345.67 = 12,345.67 -12345.67 = (12,345.67)
I have found lots of examples around the interwebs that get me close but there is either no ( ) around negatives or there is a $ included.
I am using ASP .NET 2.0 using C#. I am creating a GridView in the code behind and I can't get the date format to work in "MM/DD/YYYY". Here is my code:
I have done this using templates but now I was wondering if its possible to use DataFormatString property of gridview's asp:boundfield to capitalize the first letter of the string
I add a 'Command Field' in a data gridview, and i put a code in DataGridView1_RowDeleting and it is working..my problem now is how i can put a confirmation message before deleting a record in a datagrid?
I have gridview where there is column charges. If charges value is $0.00, I need to display it as BLANK or NULL that is it should be empty. I tried few DataFormatStrings but no luck.
On my web pages I display the data as mm/dd/yyyy and that is how the user will enter the dates as well. But when I pass the textbox control that has the date in it as a parameter to the SQLDataSource control, I need it to be sent in the YYYY-MM-DD format for the AS400. Is there a way it can be changed in between?
I have a sqldatasource control that I want to get the field values from as it is selecting. Is there any way to do this in the dsControl_Selecting event for each record without binding it to any control or formview? I would like to call dsControl.DataBind and retrieve the field values.
I have a checkbox template field in a grid view control. I want to execute some code when a checkbox is checked or unchecked - how do I do this? Which event is fired?
I am reading a dataset/datatable where I have a a varchar field (25) that represents date and time in following format (this is orginally a db timestamp format): 2010-05-03 08:48:00.000 Prior to binding the datatable to a gridview I need to show date time as: 5/3/2010 8:48:00. How can I easily convert to the needed format?
I'm using datapager in my listview control and I want my datapager to always set to default as numeric pager field equals to 1 every time. I change the items of the dropdownlist as its pagesize where dropdownlist is set to autopostback. For example if the currentpage is on page 3 but when I select any item from the dropdownlist I want to set the datapager back to its default as numeric pager field goes back to 1. How do I do this?
clarify: i am using a virtual keyboard that has to work on deferent text fields, and deferent pages, every time i click on a text field it sould pop up and every key i press i need to show on the text field....the problem, as every one knows, is to bind a deferent text field to the virtual keyboard, And as i said, also, to use it on deferent pages without rewriting the keyboard code for every page again and again, some thing that will not do... still can not give any code as there is no code to give, so there is no code...
i don't have code to show becouse i am trying to figure out how to do this and not showing a problem...
Background: I have an aspx file that holds a keyboard div and a hidden TextArea or an Input type=hidden (not decided yet). This page is a user control so it cen be used in all the pages that needs it...
What i am tring to do: Using JQuery bind('focus',...) method to bind any field in a certian aspx page (not the keyboard UC itself) to the hidden text field, i want that every thing i click on the keyboard will show in the text field that is on focus....
Can i relate in JS/JQuery to a field that is in a different page, will it recognise it? how can i do the bind, how can i transfer text from one field to another? if there a better way to do this, i will be happy to hear about it...
I ma sure this is easy but asp.net is new for me. Anyway I'm trying to collect a username and put it into a SQL database. I collected the username just fine:
Code:
[code]....
Then I tried numerous ways of trying to put it into a text box with no luck:
I know that this is easy for those that know but alas this is not me ;)
I have a multi part form that is going to write to a dB.
As a point of reference I can offer [URL](i.e., the quote process) as a model for my project.
I need to write a record on the first page and then use the auto number generated from this to populate the child records with the parent's key field.
What I was hoping to do is write the record and then send the data from the dB to the second form. Iwill then need to repeat this process for the children of the child
I am only moderately familiar with ASP.net
one thing to add is that i am not forcing the user to create an account in order to maje the initial inquiry, only if they wish to reaccess theinformation at a later date.