Jump to content
Xtreme .Net Talk

lamy

Avatar/Signature
  • Posts

    56
  • Joined

  • Last visited

Everything posted by lamy

  1. i have a page that sends to a webapi via WebClient which has a DateTime value as one of the parameter, for some reason after serializing it with JavaScriptSerializer it takes -8 out of the value here's what i tested in C# public class MyParam { public string param1 { get; set; } public DateTime param2 { get; set; } } JavaScriptSerializer serializer = new JavaScriptSerializer(); string json = serializer.Serialize(param); // param = MyParam json = serializer.Serialize(json); MyParam test = serializer.Deserialize<MyParam>(json); // less 8 hours of original value
  2. i have sets of tags that i wanted to write in my html (specifying where it should be) but i couldnt find the right approach for this atm i made a web control which serves as a place holder, then on my page i find (if its on a master page) the control and assign the content (in a property) while the control (placeholder) overides Render so it gets written to where i placed it any other way to do this? all i wanted to do is write some custom tags like these <html> <form ...> ... </form> <mycustomtag value="set" target="something"/> <mycustomtag value="invoke" target="something_else"/> <mycustomtag value="invoke" target="another"/> <mycustomtag value="terminate" target="true"/> </html> it has no order or whatsoever, itll depend on the conditions that i made. if youre wondering why i needed this its because this page is being read by my winforms application which actually handles the interface (its for a kiosk, the ui for keypads and all those are done in windows control which i invoke if i see those tags) response.write wont do since i cant tell it where to write it, thats why i made that placeholder so i know where i put it, anyone? heres what i have atm my tag writer control <ToolboxData("<{0}:TagWriter runat=""server""></{0}:TagWriter>")> _ Partial Class TagWriter Inherits System.Web.UI.UserControl Private _Content As String = String.Empty <Personalizable()> _ Public Property Content() As String Get Return _Content End Get Set(ByVal value As String) _Content = value End Set End Property Protected Overrides Sub Render(ByVal writer As HtmlTextWriter) writer.Write(_Content) End Sub End Class at code-behind i generate those tags using a class (function returning a string) and assign it to content from my page (load) TagWriter1.Content = "something here" if its on a master page Dim tag As TagWriter = CType(Page.Master.FindControl("tagWriter"), TagWriter) tag.Content = "something here"
  3. i dont think itll work, since you did it with response.write, the script was written first before the form was rendered to the page, window.opener.frmMain has no properties to deal with
  4. tnx again PlausiblyDamp, i guess ill look at remoting then.
  5. got a question PlausiblyDamp, what if i wanted to be notified that i got the request first, and get notified (return the result) when the process is done, like BeginSomething - notify that i received the request (return a value) - (should trigger the process or do the process at the End) EndSomething - process the request - notify that the process is done (return a value) can this be done by this? after reading some articles, it seems that asynchronous would only be like threadingm, or am i wrong. what im trying to accomplish is to return maybe 2 separate results, with the first one as immediate and the other as soon as it finish processing, by just requesting one webservice method? atm, in my application im populating a datatable with all the references from the request, and use it to check the result in a loop, but this is by using 2 webservice method (one to acknowledge the request, and the other to check for result)
  6. tnx PlausiblyDamp. ill take a look at that, i guess asynchronous is the way ^^ have any snippets? cant find much on the net im doing everything in .net, my winform application is calling the web method (webservice)
  7. im using a webservice to process things and return the result, now im planning to do this - send request via webservice (from client side) - return an acknowledgement (that i received the request) (to client side) and breaks the connection - process it (on server side) - return the process result (to client side) atm, i have these - send request via webservice (from client side) - process it (on server side) and return the result (to client side) my question is, is there a way to push the process result via webservice or process something after i return an acknowledgement to client side?
  8. im making an auto-update program which uses a webservice, this webservice does all returning the version of the patch and all that, including the file itself which i return as byte array, its already working when it comes to waiting until it is fully downloaded, what i did is make a structure for both the byte array and the length of the byte array, in my program i loop until the size of the data is the same as the length of the PatchFile Public Structure PatchFile Dim data As Byte() Dim length As Int64 End Structure but doing this sometimes gives me a Not-Responding application, having Nothing on data even if did request for it. is there a better way to return a file webservice or not? :confused: (i know theres clickonce but i already had my codes and this is what all i have left )
  9. was trying to add this column after i populate my datatable dt.Columns.Add(New DataColumn("ID", GetType(System.Int16))) dt.Columns("ID").AutoIncrement = True dt.Columns("ID").AutoIncrementSeed = 1000 the column is added but it doesnt show the value after i bind it to a datagrid/gridview anyone havin this same prob? btw, im using VS 2005 Express
  10. a colleague asked me if you could insert a datagrid inside a datarepeater, i wasnt sure at that time so i tried searching but was unable to get any info on it, so i tried messin with the repeater events diggin inside watch values heres what i came up with on the page i have the repeater with a datagrid within itemtemplate <asp:Repeater ID="Repeater1" runat="server"> <HeaderTemplate> <table> </HeaderTemplate> <ItemTemplate> <tr> <td> TABLE 1<br /> <%#DataBinder.Eval(Container.DataItem, "ID")%> <%#DataBinder.Eval(Container.DataItem, "NAME")%> </td> <td> TABLE 2 <asp:DataGrid ID="datagrid1" runat="server"> </asp:DataGrid> </td> </tr> <tr> <td colspan="2"> <hr /> </td> </tr> </ItemTemplate> <FooterTemplate> </table> </FooterTemplate> </asp:Repeater> in my code behind (took off the sqlclass, just the usual anyway) Protected Sub form1_Load(ByVal sender As Object, _ ByVal e As System.EventArgs) Handles form1.Load Dim dt1 As New DataTable("TABLE1") Dim query As String = "" query = "SELECT TOP 10 * ID, [NAME] FROM TABLE1" dt1 = sqlClass.execQuery(query, dt1.TableName) ' returns datatable Repeater1.DataSource = dt1 Repeater1.DataBind() End Sub Protected Sub Repeater1_ItemCreated(ByVal sender As Object, _ ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs) _ Handles Repeater1.ItemCreated Dim dt2 As New DataTable("TABLE2") Dim query As String = "" Try ' itemtemplate (can also be checked with ItemType) Dim drv As DataRowView drv = e.Item.DataItem query = "SELECT Something FROM TABLE2 where ID = '" & drv.Row.Item("ID") & "'" dt2 = sqlClass.execQuery(query, dt2.TableName) Dim datagrid1 As DataGrid = DirectCast(e.Item.FindControl("datagrid1"), DataGrid) datagrid1.DataSource = dt2 datagrid1.DataBind() Catch ' headertemplate or footertemplate (do nothing) End Try End Sub is there another way, just curious?
  11. this is how i would check it in 2003 <WebMethod()> _ Public Function Test() As String Dim sc As Microsoft.Web.Services.SoapContext = Microsoft.Web.Services.HttpSoapContext.RequestContext If sc Is Nothing Then _ Throw New System.Web.Services.Protocols.SoapException("Only SOAP requests are accepted", _ New System.Xml.XmlQualifiedName("NotSoapCall")) Return "This is a string" End Function in 2005 i would then import Microsoft.Web.Services3 so i could use SoapContext, but theres no HttpSoapContext that can be found anyone?
  12. tnx PlausiblyDamp, ill take a look at it.
  13. was wondering if id make an API for our vending machine application (connected to the internet), currently we send request and read response directly to our database, for the revamp we would want to make it more secure, but cant decide what to do, was thinking of doing an httpwebrequest or our page (ssl), but we could also do an API (server-client) to make such request/response... which one do you think is faster or is there any other way?
  14. thanks Joe Mamma, ill keep that in mind :)
  15. oops, my mistake, i didnt notice that its rendered differently with attribute Name and ID Name = MyControl$Textbox1 ID = MyControl_Textbox1 i guess the error was on document.forms[0].MyControl$Textbox and not on getElementById i guess id have to change it to this document.getElementById('MyControl_Textbox1')
  16. im trying to make a class with an array object in it but somehow reference is lost whenever i add a new item to it Public Class MyMenu Public parent()() As String Public Function AddParent(ByVal title As String, ByVal link As String) As Int16 Dim id As Int16 = 0 If Not parent Is Nothing Then id = parent.Length End If ReDim parent(id) parent(id) = New String() {title, link} Return id End Function End Class doing this works Dim id As Int16 id = m.AddParent("1", "1.htm") MsgBox(m.parent(0)(1)) id = m.AddParent("2", "2.htm") MsgBox(m.parent(1)(1)) id = m.AddParent("3", "3.htm") MsgBox(m.parent(2)(1)) but this doesnt Dim id As Int16 id = m.AddParent("1", "1.htm") id = m.AddParent("2", "2.htm") id = m.AddParent("3", "3.htm") MsgBox(m.parent(0)(1)) MsgBox(m.parent(1)(1)) MsgBox(m.parent(2)(1)) anyone?
  17. actually i didnt choose the $ sign, it was like so when it got rendered to html, is there a way to change that? hmnn... it worked for you in FF, now im totally lost coz it keeps returning undefined
  18. suppose i made a custom control with a textbox controls, when its rendered it would have (Me.ID + $ + textbox name), IE allows object names with "$" sign, so theres no problem finding/altering the object, but in FF it doesnt, so doing this wouldnt work with FF. document.getElementById("myControl$Textbox1").disable = false; anyone knows how to resolve this?
  19. i made a custom alert control (vwd express 2005) out of this, http://slayeroffice.com/code/custom_alert/, i did some alteration on css to support IE browsers without position:fixed, and took off the mispelled (dunno if intensionally) visibility property (no use for this, fixing it wouldnt show the alert) now, my question is this, popping the alert after postback would cause an exception, but it can be resolved by using setTimeout (in js), so i added it, but in some cases where the page would load longer than expected i end up with this error. "Internet Explorer cannot open the Internet site http://localhost:2220/alert/default.aspx Operation aborted" then with a "Cannot find server - The page cannot be displayed" it seems that RegisterClientScriptBlock is called too soon, is there a way to place it at the end of the file, somewhat </html> <script language="javascript"> alert("here"); </script> anyone? customalert.zip
  20. found the problem, my control in my web form has ReadOnly set to True (was hoping itll still pass the value since HTML form doesnt pass values only when its disabled) any workaround for this?
  21. i have a usercontrol with a textbox control in it, im trying to make a "Text" property for it with both get and set, setting a value isnt a problem but somehow i cant manage to retain the value of the textbox as it postback <Bindable(True), Category("Appearance"), DefaultValue("")> _ Public Property Text() As String Get Dim obj As Object = ViewState("Text") If Not (obj Is Nothing) Then Return CType(obj, String) Else Return String.Empty End If End Get Set(ByVal value As String) ViewState("Text") = value End Set End Property doing this wont work if i typed-in anything and submit the form MyLabel.Text = MyControl.Text anyone? :confused:
  22. *** resolved Const displayScriptKey As String = "someScript" If Not Page.ClientScript.IsClientScriptBlockRegistered(displayScriptKey) Then Page.ClientScript.RegisterClientScriptBlock(Me.GetType, displayScriptKey, script) End If
  23. found an article for the solution, it was to emit it once for all server controls, however i keep on getting this "obsolete" warning at "Page.RegisterClientScriptBlock" line, im using VS 2005 Express Const displayScriptKey As String = "someScript" If Not Page.IsClientScriptBlockRegistered(displayScriptKey) Then Page.RegisterClientScriptBlock(displayScriptKey, script) End If
  24. lets say i have several instances of the same custom control and i wanted the first one to load something and ignore that procedure with the rest of the custom control since its already loaded, anyone for directions? was thinking of putting this in my custom control <script language="javascript" src="something"></script> but i wanted it to load only once even if i keep dragging more of the same custom control, anyone? i can do a workaround like saving something in a session/viewstate, then check it from there, but there could be another way
×
×
  • Create New...