开发者

Regular input in ASP.NET

Here's an example of a regular standard HTML input for my radiobuttonlist:

<label><input type="radio" name="rbRSelectionGroup" checked value="0" />None</label>
<asp:Repeater ID="rptRsOptions" run开发者_开发问答at="server">
<ItemTemplate>
    <div>
    <label><input type="radio" name="rbRSelectionGroup" value='<%# ((RItem)Container.DataItem).Id %>' /><%# ((RItem)Container.DataItem).Name %></label>
    </div>
</ItemTemplate>
</asp:Repeater>

I removed some stuff for this thread, one being I put an r for some name that I do not want to expose here so just an fyi.

Now, I would assume that this would or should happen:

  1. Page loads the first time, the None radio button is checked / defaulted
  2. I go and select a different radiobutton in this radiobutton list
  3. I do an F5 refresh in my browser
  4. The None radio button is pre-selected again after it has come back from the refresh

but #4 is not happening. It's retaining the radiobutton that I selected in #2 and I don't know why. I mean in regular HTML it's stateless. So what could be holding this value? I want this to act like a normal input button.

I know the question of "why not use an ASP.NET control" will come up. Well there are 2 reasons:

  1. The stupid radiobuttonlist bug that everyone knows about
  2. I just want to brush up more on standard input tags
  3. We are not moving to MVC so this is as close as I'll get and it's ok, because the rest of the team is on par with having mixed ASP.NET controls with standard HTML controls in our pages

Anyway my main question here is I'm surprised that it's retaining the change in selection after postback.


This is a Firefox behavior.

Firefox will persist form values when you reload a webpage.

For example, if you go to StackOverflow's Ask Question page, enter some text, and reload the page, Firefox will remember the text, but IE will not.

If you re-request the page (as opposed to refreshing it) by pressing Enter in the address bar, the form will not be persisted.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜