Get Started with ASP.NET AJAX

 

I recently finished up a new article discussing how to use ASP.NET AJAX Extension controls to AJAX-enable new or existing Websites quickly and easily.  It's now available on the Simple-Talk.com Website for those that are interested in getting into AJAX more.  Code samples that demonstrate how to perform a variety of tasks (including a few not discussed in the article) are available as well.   

comments powered by Disqus

2 Comments

  • Hi,

    In your recent article "Enhance your Website with ASP.NET AJAX Extensions" you have this code in NestingUpdatePanels.aspx.cs-file:

    private int SelectedRow
    {
    get
    {
    object index = ViewState["SelectedRow"] ?? "-1";
    return Int32.Parse(index.ToString());
    }
    }

    Could you please translate the get-method in VB.NET, because all CS-VB translators doesn't recognize operator ??.

    I've translated it into
    Dim index As Object = IIf(CBool(ViewState("SelectedRow")), "0", "-1")

    but it doesn't work. Obviously "0" (true part) is not right. Thanks

  • ?? is a short-cut way of checking if an object is null or not. If it's not null, the value is used, if it is null the value on the right-side of the ?? operator is used. VB.NET would look something like the following:

    Dim index as Object = ViewState("SelectedRow")
    If index Is Nothing Then
    index = "-1"
    End If
    Return Int32.Parse(index.ToString())

Comments have been disabled for this content.