Thanks for your reply, I have a render event in my control that fires to fill up the textboxes etc... You have given my an idea to why this is happening, it appears that the value thats in passed to the first control is now 0 at postback, i'll have to create some kind of collection to store these in session. However when i fix this value, the controls a rendered but i now lose all my data as everything goes to 0. So is appears that all the data in the controls is lost due to the postback. this is going to be one almighty collection stored in session, the viewstate is going to be massive! Thanks for your help Andy
Fu Manchu
Posts
-
How to persist 'doubled up' usercontrol in a datalist and a repeater control across a postback - arghhh! -
How to persist 'doubled up' usercontrol in a datalist and a repeater control across a postback - arghhh!Hi guys, I don't know which way to go with this i think ive exhausted all efforts. My usercontrol display information but when i click update a full page postback occurs and i lose everything, my control disappears! I have an extremely large amount of data to display to the users, so using exsiting controls like a gridview is just silly. I've opted for a usercontrol that displays a set of prices by location and product. I have also given the user a couple of checkbox controls to be able to select groups of locations and groups of products. Ive put my usercontrol in another with a datalist and a objectdatasource that gets a list of the locations and this accepts a productID, this is why im saying 'doubled up'. A usercontrol within a usercontrol! Not sure if this is the best solution? Because i cant directly access the control with a datalist? On the main form, i have a repeater control with the usercontrol inside it. This repeats the locations selected (9 max) (created by the datalist) for every product (33 max) selected if you get me! Each control has an update button, but when its clicked the controls disappear. Listed below is the second control:-
<asp:DataList ID="DataList1" runat="server" RepeatColumns="3" DataSourceID="ObjectDataSource1"> <ItemTemplate> <uc1:CompanyPriceWidget ID="CompanyPriceWidget" runat="server" companyName='<%#Eval("Company.CompanyName")%>' productCost='<%#Eval("StockItemProductCostSterling")%>' retailSalePrice='<%#Eval("StockItemRetailSalePriceSterling")%>' productCostOverHead= '<%#Eval("StockItemProductCostOverHead")%>' retailSalePriceOverHead='<%#Eval("StockItemRetailSalePriceOverHead")%>' ExchangeRate='<%#Eval("Company.CurrencyExchangeRate.CurrencyRate")%>' companyId='<%#Eval("Company.CompanyID")%>' OnUpdateValues="CompanyPriceWidget_UpdateValues" /> </ItemTemplate> </asp:DataList> <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="GetListOfStockValueGroupedByCompany" TypeName="StockValueSterlingDel" OldValuesParameterFormatString="original_{0}"> <SelectParameters> <asp:Parameter Name="stockItemPriceBandId" Type="Int32" /> </SelectParameters> </asp:ObjectDataSource>
On the Main Form<asp:Re
-
How to Linq query using anonymous types to XML?Thanks, i've just figured this out myself look through a linq book ;) .
-
How to Linq query using anonymous types to XML?Again this is not what i'm asking if you read my first post, i'm trying to do this...
Dim xml As XElement = Nothing
For Each item In myStock
xml = <Stock>
<Shipping><%= item.ShippingStatus %></Shipping>
<Serial><%= item.SerialNumber %></Serial>
</Stock>
Next
xml.Save("C:\Delete Me\test.xml")But this won't work because, it will iterate through the entire collection and give the last element - because xml will be passed new data on every loop. I stated this at the start though! What i'm asking is can i use my ienumerable variable and pass its contents to a xelement, so i can define the schema of my data as xml....
dim xml = <Stock>
<ShippingStatus>some code here </ShippingStatus>
<SerialNumber>some code here </SerialNumber><Stock>
Andy
-
How to Linq query using anonymous types to XML?Sorry this is my fault for trying to make it short and sweet. What i'm trying to say here is the scope of the parameters i.e shippingstatus, serial numbers..etc is lost due to the anonymous typing. Is there an object or collection i can convert myStock to to get the intellisense of the parameters? ie... Dim myStock = From stock As StockItem In db.StockItems _ Join rail As RailStock In db.RailStocks On stock.PK_StockItemID Equals rail.FK_StockItemID _ Select New With {.ShippingStatus = stock.FK_ShippingStatus, .SerialNumber = rail.StockSerialNumber} when you do.. MyStock. -- the intellisence won't find any parmeters, although this is not a problem the end result here is i'm trying to get the data from and sql database into xml - linq is capable of both, so it seems the obvious choice. since the query collection or whatever is called within linq is deferred until you iterate through it, i'm stuck at how to get items out of it? Thanks
-
getting value of a textbox from a datagridWell i'm gonna assume here.... i think this is because you may have forgot about the headers in your gridview/datagrid etc.. so you need to do this...
If e.Item.ItemType <> ListItemType.Header Then
Dim tbox As TextBox = CType(e.Item.FindControl("txtQty"), TextBox)
End if
Hope this helps! Andy
-
Transparency working only on development computeris the developement computer a server? sometimes it can depend on how the themes are setup in XP, i.e. windows classic etc.. Do you have XP styles enabled in the properties of the application, go to properties in visual studio in the application tab look to see if this changes anything? Andy
-
Serial communication in 3.5http://www.dreamincode.net/forums/showtopic37361.htm[^] this is a good tutorial that is know will convert to 3.5, i've used it many times before. Andy
-
How to Linq query using anonymous types to XML?Hi all, This one always gets me? im using anonymous types because i'm joining several tables together in my linq query, the question is how do i iterate though my collection to store the result to xml. Or is there a way to send the linq result directly? My Query is, and i've simplified it...
Dim myStock = From stock As StockItem In db.StockItems _
Join rail As RailStock In db.RailStocks On stock.PK_StockItemID Equals rail.FK_StockItemID _
Select New With {.ShippingStatus = stock.FK_ShippingStatus, .SerialNumber = rail.StockSerialNumber}From here, i'm unsure how to convert the anonymous type to a object that has the scope of my parameters? Obviously , if i do this i just get the last set of elements in the result set
Dim xml As XElement = Nothing
For Each item In myStock xml = <Stock> <Shipping><%= item.ShippingStatus %></Shipping> <Serial><%= item.SerialNumber %></Serial> </Stock> Next xml.Save("C:\\Delete Me\\test.xml")
Thanks anyway Andy
-
Mailing send error due to ... !!!Hi, When you say it works at home? Alarm bell should be ringing here! if it works what are you doing differently at uni, i.e. are you using a wired connection at home and a wireless connection at uni etc... Many uni's have proxy servers and this could also be an issue - you need to take the uni out of the equation try it on a different wireless network and eliminate the problem down. To test your code try and a do a simple web request i.e get the html or a website,you can get the code off google, if it this in both places then this tells you you can acces the web your uni's proxy if not then its got to be your code, and you may have to pass up them credentials also. Andy
-
Converting MFC apps to .netsorry, that exactly what i'm doing i dont care for the windows stuff and dialogs - i'm just trying to get the business logic end that connects to the API - the rest can be done in .net so you reckon its possible, basically i just want to have a class C++ that i can wrap in MC++. i would call the method etc from .net and get the returned data.
-
Converting MFC apps to .netThe application uses an API to access the currency exchange, the application was design by the company that allows this access - and by modern stardards is not very good. this app is pretty simple, by this i mean its just got one menu and about 6 items in the menu, when selected by the user the API writes the info to a log window, and like you say my plan was to capture this in a console window with cout etc... yes your right about the classes being spread about, this is the MFC stuff which is why i've included the the MFC classes in the console application. my question here would be this, is there any difference in solution settings from an MFC app to a console app. By this a mean what tells the compiler to run if you comment all the code in the MFC app and paste the code from a console app it will not run! andy
-
string convert to operatorwant you have here is a casting problem. i guess that you want have the option to have different operators in the in 'b' so you could do basic maths operation....+ \ - * if this is so...what i would so is have b a dropdownlist or combobox with the selection fixed and maybe have it defaulted to '+' the next thing to do if make textbox 'a' and 'c' only except numbers, you can find many example of this on the web and once you have done this because you know that only number are going be entered you can cast the strings to ints i.e. Dim int1 As Integer = CType(textbox1, Integer) Dim int2 As Integer = CType(textbox3, Integer) then based on the selection do a case select to do the calculation hope this is what you wanted....
-
Get the list of currently Running programthe anwser is .....Imports System.Diagnostics.Process with is not that obvious Imports System.Diagnostics.Process Module Module1 Sub Main() Dim myProcess() As Process = Process.GetProcesses() For Each proc As Process In myProcess Console.WriteLine("Process: {0} ID: {1}", proc.ProcessName, proc.Id) Next End Sub End Module Andy
-
Converting MFC apps to .netHi all, I have tried posting the dedicates subjects, but it seems that knowone has the knowledge or just so obnoxious they dont care for any other language and as soon as you mention VB or .net well thats it....see u later Out of all the .net languages i prefer VB.net, its just easier to work with. So does anyone in here know anything about MFC apps, first i would like to convert an MFC windows app to a MFC console app and then wrap it in MC++ with the #pragma umanaged and #prama managed blocks. Once i have this working i can create a .net DLL, instead of the console app, this DLL with import straight into a VB.net application and allow me to leverage the COM method within the API and also have the .net functionality. I explain this because, i would not expect every VB coder to understand this but someone with C++/MC++ should understand without thinking.......NOT! http://www.codeproject.com/script/Forums/View.aspx?fid=3785&msg=2565053[^] All i'm asking here is what i need to do you make the existing MFC app, that has windows etc.., into a console app - like a DOS prompt. Thanks
-
Wrapping MFC project to .neteh, Sounds like you’re just in here for a laugh, I’ve been programming in many DIFFERENT languages for over 10 years, if you have nothing useful to add then don't question my ability... I’ve done this before and i'm not in anyway a beginner - i came here for advice but it seems to me know one here has the knowledge or the qualifications to help!
-
Wrapping MFC project to .netwell, i guess the windows stuff etc.. the code is an API for currency forex exchange - but i want to extract the main functionality of the API code and convert this to .net. the application is a sample app, it just has a menu with some basic functions - nothing fancy.
-
Removing MFC classes, and replacing with ANSI C++eh, you have int,double and string as well but you still need to make the existing code work, compile and build before you can convert to .Net just because .net as these function, isn't an answer you've missed the point! The existing code creates an instance of Ctime which is a MFC function, if i dont use this or an equivalent method, how can leverage .net time functions in C++
-
Removing MFC classes, and replacing with ANSI C++Hi all, I am trying to convert a API that's used in a MFC app, i want to convert this to .net. But i think it will make the job easier to strip out the MFC stuff and replace it with ANSI C++. I want to get it all working in a console app, so the MFC stuff is causing all the problems! Well i think? In the code i have..... CTime time; CTime datavalue; CTime is a MFC datatype, this i believe is different from the ctime method in the time.h. Is there a ANSI C++ class that will replace this? I thought about this a wrote a class like this.... class Ctime { public: time_t GetUTCTime(void); }; time_t Ctime::GetUTCTime() { time_t UTCTime; UTCTime = time(NULL); return UTCTime; } its missing a pointer, because i've spent so long in the .net world i've forget how to write C. I'm not sure if this will work anyway but at least i'll have the basic class replacement. thanks..
-
Wrapping MFC project to .netI all, need to convert a MFC app to .net, would it be wise to strip out the MFC stuff first to just have normal ANSI C++ code and then wrap it in MC++? not sure if i'll run into problems later. thanks