I have put some sitesetting code in CRM to extract some data and display it on a ASP.NET website webgrid.
Everything works fine, but one column of money does not display the value but rather: Microsoft.XRM.SDK.Money, I want the real value to be displayed.
My code:
<WebGridColumn Name="betrag" DataMember="betrag" Position="7"
Caption="Betrag" Width="100" />
I tried to do something with datatype and dataformat but it did't work.
Here is a picture of the output that I get, I want the real value displayed where it says Microsoft.XRM.SDK.Money
Money is an object, if you want to know the value you need to access to its .Value because if has more atrributes like the currency.
Related
First, I did try to manually set readonly to false.
My code is company code so I can't share it here. I'll do my best to explain.
In a Webforms projects my .aspx page has a GridView with all the columns listed that I want to display. Additionally it has edit, delete, and update buttons for each row. Three columns are dates, and the data conversion from Oracle to asp ends up making the dates appear as "MM/DD/YYYY 12:00:00am". To strip off the timestamp, I put e.Row.Cells[x].Text = e.Row.Cells[x].Text.Split(' ')[0]; in the GridView's OnRowDataBound event.
It worked beautifully, I thought, until I started testing the edit buttons again. All three rows that have dates and the event above are now a blank white space when I put the row into edit mode. If I comment those three lines in OnRowDataBound out, the timestamps reappear and the rows are editable.
First and foremost, I need to make it work. Secondly, I'd love to know what is actually happening in the background. I'm pretty new to web dev as a whole and new to asp.net for sure.
If you create your columns in markup (AutoCreateColumns being turned off), you can use DataFormatString to format the date columns instead of modifying the cell text in code:
<asp:BoundField DataField="Date1" DataFormatString="{0:d}" ApplyFormatInEditMode="true" ... />
The format string (d in my example) can be modified to better match your preferences. And if the date columns are editable, you can also set ApplyFormatInEditMode as shown above.
I have done this a couple years ago but can't seem to remember how; I am working with access 2010 and the macro builder as opposed to VBA ( I don't do this enough for the coding).
Anyways what I have is a main form that has a subform that displays as a datasheet. This subform data source is a query that asks for three values which are applied as filters using just a where statement.
The query SQL is a select statement, followed by from and then a where statement and no parameter statement.
What I am trying to do is get the subform when it opens to pull the parameters from the main form record it is under.
I know this is possible because I have done this a couple years ago but don't have that database anymore. I have gone through all the books I have and still can't seem to find a combination that works.
Any suggestions or help with what I am missing?
****Update******
The set value isn't working... What I have is a form SQ_Ticket that has fields Site Number, Date Submitted, and End Date. I then I have a sub form that is based on a parameter query, it has a different number of fields then then the ticket query so a Union is too much of a hassle. But the fields in the sub form that would relate to the main form are Site Number and create date.
What I am trying to do is I have the main form (SQ_Ticket) with a sub form (SQ_Alarm_Parameter subform) and the form is a datasheet. When I click to expand the subdatasheet I want the Parameter query to pull the Site Number from the main form and use it to match to the site number in the subform and the pull the Date Submitted and End Date and use it as the start and end in a between statement for the create date in the sub form.
Basically I want to use find all records in the sub form (SQ_ALarm_Parameter subform) that have the same Site Number as the record in SQ_Ticket and that are Created between the Date Submitted and End Date of the Record in SQ_Ticket.
I seem to recall needing to pull the specific data from the main form and then using it as a temp value in the subform, but again can't remember how do to do that.
I know I am missing something obvious since I know I have done this before, but I didn't think to keep a copy of that work and it was quite a while ago. So I really appreciate the help
Firstly, I think taking a few minutes to do the VBA would be valuable and easier to work with. However with the macro method you can just use the Set Value submacro. This won't show up by default so you will need to select "Show All Actions" on your ribbon at the top of Access.
The Macro:
This will allow you to set the RecordSource for one form based off of value of a textbox on another form. You just need to adjust now work with your fields and parameters.
I have a little appliation that shows MySQL data in web browser ListGrid. It has 14 columns.
I would like to upgrade it so the user could add query parameters.
For this job the best I could imagine is the grid.setShowFilterEditor() that put text boxes above the column headers and will live together with the column header when moved or resized.
I planned to use the filter button FilterEditorSubmitHandler() to get the filter values and run the query.
Unfortunately, I can not find any solution to get the text from a certain filter box eg. the value that was written by the user into the box above Column_#1. Is there any way to do that or this FilterEditor grown together with the DataSources object, and not available for any other data binding?
Something like this, but without using DataSource:
http://www.smartclient.com/smartgwt/showcase/#grid_sortfilter_disable_filter
As per my knowledge, filter editor works on com.smartgwt.client.data.DataSource only.
If you want to have filterEditor in ListGrid, you have to use DataSource or go for some custom implementation.
I have a gridview, that I made editable. That works... sort of.
Now I'm trying to update a row with new data.
The row has columns like:
=========================
| Time | Date | Project | etc etc |
=========================
I'm trying to save the contents of the edit boxes that appear as i Edit a row.
The way I do it is like this:
TextBox time = (TextBox) GridView1.Rows[e.RowIndex].FindControl("txtTime");
--linq-object-reference--.time = Convert.ToInt32(time.Text);
But I recieve an error... Anyone know why?
EDIT:
To clarify my problem... I wanna find out how to fetch the contents of those TextBoxes, like in this picture:
EDIT2:
Okay, here's the exact error...
Time should not be saved as integer in database. It is better to save it as DateTime in database.So set your --linq-object-reference--.time as a Datetime type.
Then Use the following code to convert your textBox string value(HH:mm ->eg:03:45 ) to DateTime using the following code:
using System.Globalization;
--linq-object-reference--.time=DateTime.ParseExact(time.Text,"HH:mm", CultureInfo.InvariantCulture);
Hope this will solve the issue...
I'm not sure if 5,4 or 17-05-2011 14:15:31 is the text in your txtTime TextBox, but neither of these are going to be able to be converted to an integer. For the first field, you'll probably need some custom string parsing, and for the second, you should be able to use Convert.ToDateTime(time.Text).
EDIT:
Ok, your error message is a bit confusing, as it says the error is in Convert.ToDouble, but you've put Convert.ToInt32 in your question. Anyway, you've got a NullReferenceException, so either linqObject is null (so you can't access the time property), or time is null (so you can't access the Text property). Maybe some null checks will help you out.
another EDIT:
Ok, so your real problem is you can't get a reference to your txtTime TextBox. You'll probably need to post some markup for your GridView and some code for the event handler. Here's some suggestions:
If you debug into your event handler, check the value for e.RowIndex - make sure this corresponds to the correct row.
Ensure the ID string you're using in the code-behind is exactly the same as the ID in the markup.
Are you using any UpdatePanels, or is the GridView being updated client-side?
Is ViewState turned off?
Does anyone know how to retrieve and display data from database using combo list? What I mean is this..I have a form..in the form there is a combo list and two textfiels..the user need to choose their company using that combo list..once they have chose their company, the address and contact number of the company will be display in the next two textfields called CAddress and CContact..for example, if the user chose company ABC..how can I display the company ABC address and contact number in those textfields? Need help. Thanks.
first of all you could use javascript and make a call ajax to an asp page passing the id of the company ... in that page you can jsut response.write the infos u need as a xml format ... even csv format would work ... then jsut take the response and write it in the textbox