2014 m. sausio 26 d., sekmadienis

JQuery: kaip iškviesti WebService metodą sinchroniškai ir nusiųsti parametrus JSON formatu?

 $.ajax({
                             type: "POST",
                             url: sServiceURL + "/reorderRecord",
                             async: false,
                             data: '{ ordNew:' + JSON.stringify(reOrd) + '}',
                             contentType: "application/json; charset=utf-8",
                             dataType: "json",
                             success: function (msg) {
                                 alert("duomenys perduoti sekmingai");
                             },
                             error: function (xr) {
                                 alert(xr.responseText);
                             }
  });

2014 m. sausio 22 d., trečiadienis

GridView: RowUpdating



 Protected Sub gvMainGroups_RowUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles gvMainGroups.RowUpdating

        Dim iID As Integer = e.Keys(0)

        Dim oGridRow = gvMainGroups.Rows(gvMainGroups.EditIndex)

        Dim srtOrd As TextBox = oGridRow.FindControl("tbSortOrder")

        Dim obj = (From mg In odb.MainGroups Where mg.Id = iID).First

        obj.ProductGroup = e.NewValues("ProductGroup").ToString.Trim
        obj.SortOrder = If(srtOrd.Text.Trim <> "", CInt(srtOrd.Text.Trim), CInt(1))

        odb.SubmitChanges()

        gvMainGroups.EditIndex = -1
        bind()
    End Sub



2014 m. sausio 21 d., antradienis

JQuery: kaip iškviesti webService metodą sinchroniškai?

 window.onbeforeunload = function () {

            var val = false;

            $.ajax({
                type: "POST",
                url: sServiceURL + "/checkRecordsStatus",
                async: false,
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (msg) {
                 
                    if (msg.d == true) {
                        val = true;
                    };

                }

            });

            if (val == true) {
                return 'Turite neišsaugotų testavimo įrašų!';
            }

        };

Protected Sub Page_PreRender(sender As Object, e As EventArgs) Handles Me.PreRender

        ScriptManager.RegisterStartupScript(Me, Me.GetType, "Service", "sServiceURL='" & VirtualPathUtility.ToAbsolute("~/ServicesPath.asmx") & "';", True)

    End Sub

JQuery: unload event, JavaScript: onbeforeunload event

Problema: pagauti įvykį, kad su window.open atidarytas langas uždaromas ne mygtuko paspaudimu, o pasirinkus dešiniajame viršutiniame kampe esantį mygtuką.

Sprendimas: naudoti unload event - lango užsarymo metu

 $(window).unload(function () {
            alert("Handler for .unload() called.");
        });



Arba naudoti onbeforeunload, prieš uždarant langą:

window.onbeforeunload = function () {
            return 'You have unsaved changes!';
        }

http://api.jquery.com/unload/ - JQuery įvykis

http://help.dottoro.com/ljhtbtum.php - onbeforeunload IE įvykis



http://help.dottoro.com/ljfvvdnm.php - visi įvykiai

2014 m. sausio 14 d., antradienis

ChartImageHandler in web.config

Dirbant su diagramomis, web.confige galima nurodyti, kur saugoti suformuotas diagramas. Jas galima saugoti:

atmintyje arba sesijoje 

< add key=" ChartImageHandler " value = " Storage = memory " / >

faile į nurodytą direktoriją

<appSettings>
    <add key="ChartImageHandler" value="Storage=file;Timeout=20;Url=~/rprts/tempImages/;deleteAfterServicing=true;webDevServerUseConfigSettings=false" />

</appSettings>

2014 m. sausio 9 d., ketvirtadienis

Entities and LIKE

Problema:
 
LINQ to Entities does not recognize the method 'Boolean Like(System.String, System.String)' method, and this method cannot be translated into a store expression.
 
   objs = From no In odbef.IKSA19_OrdNo_ProdCode
          Where Not no.IKSA19_Records.Any()
          Select no
          Distinct
 
   If tbOrderNo.Text.Trim <> "" Then
 
       objs = objs.Where(Function(x) Data.Linq.SqlClient.SqlMethods.Like(x.OrderNo, tbOrderNo.Text.Trim & "%"))
 
   End If
 
 
 
 
Sprendimas: naudoti contains
 
 
If tbOrderNo.Text.Trim <> "" Then
   objs = objs.Where(Function(x) x.OrderNo.Contains(tbOrderNo.Text.Trim))
End If
 
 
 

2014 m. sausio 8 d., trečiadienis

Attribute specifier is not a complete statement. Use a line continuation to apply the attribute to the following statement.

Problema:
 
·         CompilerServices.DesignerGenerated()> _
·         "font-size:9.16667px"><WebService(Namespace:="http://autogalleries.ca/")> _
·         =WsiProfiles.BasicProfile1_1)> _
·         ScriptService()> _
·         When I try to compile, it gives me the error: 
Error 1
Attribute specifier is not a complete statement. Use a line continuation to apply the attribute to the following statement.
 
 
Sprendimas:
 
_ turi būti dedamas vienu tarpu nuo eilutėje esančio teksto, pvz.,:
 
BLOGAI: CompilerServices.DesignerGenerated()>
GERAI: CompilerServices.DesignerGenerated()> _
 
 
Line continuation character '_' must be preceded by at least one white space and must be the last character on the line.