locked
Dont under stand tabs.SelectedIndex = (Request["index"]==null) ? 0 : Convert.ToInt32(Request["index"]); RRS feed

  • Question

  • User1503786127 posted

    On Page : Banner.ascx.cs  it has a line of code:

    tabs.SelectedIndex = (Request["index"]==null) ? 0 : Convert.ToInt32(Request["index"]);

    I dont understand what it does can some one help me .

    Also on HTML : it has <%=Global.GetApplicationPath(Request)%> Where does the parameter Request come from

    Thanks

    Anh

     <%# ((ASPNET.StarterKit.TimeTracker.BusinessLogicLayer.TabItem) Container.DataItem).Name %>

    Friday, January 6, 2006 9:07 AM

All replies

  • User-821131223 posted
    What

    "statement ? value1 : value2"

    does is evaluate to value1 is the statement is true, otherwise it evaluates to value2. In your example, if Request["index"] is a null value (Request["index"]==null returns True) then SelectedIndex will be 0, if it isn't a null value then SelectedIndex will be Convert.ToInt32(Request["index"]). In other words, Request["index"] as a number.

    Request is actually a member of the Page object. You can shorten it to just Request but its full name is Page.Request. The Request object is a container for items on the query string, items sent as part of a Form submission, items sent as cookies and some server variables also.

    Friday, January 6, 2006 10:35 AM