Home > Mobile >  Why Asp.net tags are not visible on browser?
Why Asp.net tags are not visible on browser?

Time:04-09

The html tags are successfully displayed in the browser. But Asp.net's radio button, button etc. tags are not visible in the browser. No tags starting with <asp: appear in the browser.

Index.cshtml codes:

@{
    ViewBag.Title = "Home Page";
}
<select name="action:selectAdiSoyadi">
    <option>kişi1</option>
    <option>kişi2</option>
    <option>kişi3</option>
</select>

<br />


<asp:RadioButtonList runat="server">

    <asp:RadioButton runat="server" name="radioBtnGiris"></asp:RadioButton>GİRİŞ
    <asp:RadioButton runat="server" name="radioBtnCikis"></asp:RadioButton>ÇIKIŞ

    @*<input id="Radio1" type="radio" style="width:50px; height:50px;"/>*@

</asp:RadioButtonList>


<br />
<br />

<button type="button" >KAYDET</button>

Image of the page in the browser

CodePudding user response:

try this?

<asp:RadioButtonList runat="server">
    <asp:ListItem>Item 1</asp:ListItem>
    <asp:ListItem>Item 2</asp:ListItem>
</asp:RadioButtonList>
<asp:RadioButton runat="server" name="radioBtnGiris" Text="GİRİŞ" />
<asp:RadioButton runat="server" name="radioBtnCikis" Text="ÇIKIŞ" />

CodePudding user response:

You can use this instead:

<input type="radio" value="value1" id="radio1" name="radioBtnGiris" />Giriş
<br />
<input type="radio" value="value2" id="radio2" name="radioBtnCikis" />Çıkış
<br />

CodePudding user response:

This is how the .net framework is designed.

A browser on your phone, or Chrome, or FireFox browser has ZERO to do with Microsoft.

So, all .net stuff you put in the markup during design mode?

It don't matter. what happens is your web code and your asp.net markup is pre-processed by IIS (the web server) and that .net code BEFORE being sent down to the client side browser.

A browser does not have say a GridView, or a RadioButtonList tags, and has ZERO clue about asp.net. A browser can ONLY consume and ONLY use standard HTML.

So, the .net framework takes those tags, and pre-processes them into standard HTML tags that will work on ANY browser - even ones that don't know about Microsoft and the .net frame work.

So, all and any of the asp.net "tags" are in fact converted into plane jane HTML.

So, if you drop in say this:

 <asp:GridView ID="GridView1" runat="server">
 </asp:GridView>

Well, if we go look up some book about HTML? You NOT seen that HTML has GridView. It does NOT exist.

So, what does the above become browser side when using ANY browser - even those that don't know or care about .net?

the above is pre-processed into standard HTML markup (a table tag).

Your code behind runs, say loads up the GridView. and THEN the HTML is sent to the client browser side.

You now see this in the browser:

enter image description here

Or, the HTML markup is now this:

<table cellspacing="0" rules="all" border="1" id="GridView1" style="border-collapse:collapse;">
    <tr>
        <th scope="col">ID</th><th scope="col">HotelName</th>
    </tr><tr>
        <td>19</td><td>My Cool</td>
    </tr><tr>
        <td>23</td><td>Ramada Lodge</td>
    </tr><tr>
        <td>24</td><td>RETAIL</td>
    </tr><tr>
        <td>26</td><td>Sandman Inn</td>
    </tr>
</table>

Note how the client HTML send from .net is 100% plane jane HTML.

The Gridview is pre-processed by the .net system, runs your c# or vb.net code behind, and THEN sends ONLY that part to the browser.

As you can see, the results do not have ANY asp.net tags - they NEVER make the trip to the client side browser.

A browser can only consume and ONLY allow plane jane HTML.

So, the GridView gets converted into a good old fashion HTML table with standard HTML tags for rows etc.

Note again: Some apple iPhone browser don't care about Microsoft, don't know about Microsoft and asp.net. Such browsers ONLY allow plane jane standard HTML markup. Such browsers can only consume plane jane HTML, and that is the ONLY things that get sent to the browser when using asp.net.

So, the web server, and the code behind, and the .net framework? It pre-processes that asp.net markup and those asp.net tags, and CONVERTS them into plane jane good old fashioned HTML tags and code.

So, that is why you don't see the asp.net tags in the client side browser results.

All such "tags" in your web page markup are pre-processed, and converted into HTML BEFORE sending to the browser side.

After all, you can use a non Microsoft computer such as a smartphone, or even a Linux desktop computer with a browser.

As long as that browser can consume and use standard HTML 5 tags, then it will and can be used when hitting a asp.net web site.

However, while that web site is running say vb.net, or c# code behind on the server?

It don't matter, since as long as that whole system of asp.net tags, and the code behind written in c# or vb.net spits out STANDARD HTML, then you don't care, and this is why and how ANY computer, even a non windows one without .net can use such web pages.

So all the raw web page and mark-up tags and code is pre-processed by the net system, and along with your code behind that runs?

Then the plane jane HTML data and page is send to the client browser. NONE of the special tags or asp.net or even anything that belong to Microsoft and the .net frame work is ever sent to the browser side.

Only clean, normal, plane jane HTML is sent to the browser, since that is only what a browser knows about, and such browsers have nothing to do with asp.net, c# and vb.net code, and in fact have nothing to do with Microsoft.

As long as that complex frame work and system spits out HTML, then any browser can consume the results.

so, the "source code" or setup to build and design and run your code is asp.net.

but, the results it spits out and renders is only HTML, which then can work with any browser - including non Microsoft ones.

Thus any and all "asp.net" tags are removed, and converted into plane jane standard HTML for any browser to consume.

So, you ever see any of your aps.net tags when you example the browser side HTML - you only get and see plane jane HTML tags.

It also why you need to run a Microsoft web server for this to work. While the client side browser can be any browser. the server side to make this work has to be running Microsoft IIS (information internet services from Microsoft).

You can't consume those pages with JUST a browser, you need the whole .net framework system running on a web server to process that .net code, .net markup into a plane jane web page which is THEN sent to the browser side.

  • Related