Search Results

Search found 265 results on 11 pages for 'radiobutton'.

Page 1/11 | 1 2 3 4 5 6 7 8 9 10 11  | Next Page >

  • creating a radiobutton control in vb.net

    - by reffer
    ok this is my code in vb.net behind where i am creating the radiobutton - TD = New HtmlTableCell Dim rdb As New RadioButton() rdb.ID = "rdb_ads_" & DR("ID") TD.Controls.Add(rdb) TR.Cells.Add(TD) It displays the radiobutton, but doesnt select single. i can select all at one time. how do i make it to select only 1 at a time. i know its basic for u guys, but will help me a lot

    Read the article

  • radiobutton not working in allkeys

    - by gerred
    i have a radiobutton built throught my code. this is the code for that. dim 1 as intereger = 0 Dim rd As New RadioButton rd.ID = "rd_" & i rd.GroupName = "rd_g" TD.Controls.Add(rd) i = i+1 the reason i gave groupname is so that when i select the radiobutton only one is selected at one time and not all. but this creates a problem in my save button. here's the code for that - For Each key As String In Request.Form.AllKeys If key.Contains("rd_") Then Dim temp1 As String = key.Substring(key.IndexOf("rd_")).Replace("rd_", "") Dim id As Integer = Val(temp) If id 0 Then SQL = "select .... " In the Request.Form.AllKeys I only get the groupname and not the ID of the radiobutton that i need. what am i doing wrong?

    Read the article

  • Eval ID on radiobutton in Datalist

    - by ravi
    my code gota datalist with radio button and iv made it single selectable onitemdatabound....now im trying to evaluate a hiddenfield on basis of selected radio button my code goes like this aspx code <asp:DataList ID="DataList1" runat="server" RepeatColumns = "4" CssClass="datalist1" RepeatLayout = "Table" OnItemDataBound="SOMENAMEItemBound" CellSpacing="20" onselectedindexchanged="DataList1_SelectedIndexChanged"> <ItemTemplate> <br /> <table cellpadding = "5px" cellspacing = "0" class="dlTable"> <tr> <td align="center"> <a href="<%#Eval("FilePath")%>" target="_blank"><asp:Image ID="Image1" runat="server" CssClass="imu" ImageUrl = '<%# Eval("FilePath")%>' Width = "100px" Height = "100px" style ="cursor:pointer" /> </td> </tr> <tr > <td align="center"> <asp:RadioButton ID="rdb" runat="server" OnCheckedChanged="rdb_click" AutoPostBack="True" /> <asp:HiddenField ID="HiddenField1" runat="server" Value = '<%#Eval("ID")%>' /> </td> </tr> </table> </ItemTemplate> </asp:DataList> code behind protected void SOMENAMEItemBound(object sender, DataListItemEventArgs e) { RadioButton rdb; rdb = (RadioButton)e.Item.FindControl("rdb"); if (rdb != null) rdb.Attributes.Add("onclick", "CheckOnes(this);"); } protected void rdb_click(object sender, EventArgs e) { for (int i = 0; i < DataList1.Items.Count; i++) { RadioButton rdb; rdb = (RadioButton)DataList1.Items[i].FindControl("rdb"); if (rdb != null) { if (rdb.Checked) { HiddenField hf = (HiddenField)DataList1.Items[i].FindControl("HiddenField1"); Response.Write(hf.Value); } } } } the javascript im using... function CheckOnes(spanChk){ var oItem = spanChk.children; var theBox= (spanChk.type=="radio") ? spanChk : spanChk.children.item[0]; xState=theBox.unchecked; elm=theBox.form.elements; for(i=0;i<elm.length;i++) if(elm[i].type=="radio" && elm[i].id!=theBox.id) { elm[i].checked=xState; } } iam getting an error like this Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled. Details: Error parsing near 'pload Demonstration|'. is there any other way to do this or can nyone plz help to get rid of this problem

    Read the article

  • WPF Databound RadioButton ListBox

    - by Mark
    I am having problems getting a databound radiobutton listbox in WPF to respond to user input and reflect changes to the data it's bound to (i.e., to making changes in the code). The user input side works fine (i.e., I can select a radiobutton and the list behaves as expected). But every attempt to change the selection in code fails. Silently (i.e., no exception). Here's the relevant section of the XAML (I think): <Setter Property="ItemContainerStyle"> <Setter.Value> <Style TargetType="{x:Type ListBoxItem}" > <Setter Property="Margin" Value="2" /> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type ListBoxItem}"> <Border Name="theBorder" Background="Transparent"> <RadioButton Focusable="False" IsHitTestVisible="False" IsChecked="{Binding Path=IsSelected, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}" > <ContentPresenter /> </RadioButton> </Border> </ControlTemplate> </Setter.Value> </Setter> </Style> </Setter.Value> I bind the listbox to a List of SchoolInfo objects. SchoolInfo contains a property called IsSelected: public bool IsSelected { get { return isSelected; } set { if( value != isSelected ) { isSelected = value; this.OnPropertyChanged("IsSelected"); } } } The OnPropertyChanged() stuff was something I put in during my experimentation. It doesn't solve the problem. Things like the following fail: ((SchoolInfo) lbxSchool.Items[1]).IsSelected = true; lbxSchool.SelectedIndex = 1; They fail silently -- no exception is thrown, but the UI doesn't show the item being selected. Mark

    Read the article

  • ASP.NET RadioButton messing with the name (groupname)

    - by Hojou
    I got a templated control (a repeater) listing some text and other markup. Each item has a radiobutton associated with it, making it possible for the user to select ONE of the items created by the repeater. The repeater writes the radiobutton setting its id and name generated with the default asp.net naming convention making each radiobutton a full 'group'. This means all radiobuttons are independant on each other, which again unfortunately means i can select all radiobuttons at the same time. The radiobutton has the clever attribute 'groupname' used to set a common name so they get grouped together and thus should be dependant (so i can only select one at a time). The problem is - this doesn't work - the repeater makes sure the id and thus the name (which controls the grouping) are different. Since i use a repeater (could have been a listview or any other templated databound control) i can't use the RadioButtonList. So where does that leave me? I know i've had this problem before and solved it. I know almost every asp.net programmer must have had it too, so why can't i google and find a solid solution to the problem? I came across solutions to enforce the grouping by javascript (ugly!) or even to handle the radiobuttons as non-server controls, forcing me to do a Request.Form[name] to read the status. I also tried experimenting with overriding the name attribute on the PreRender event - unfortunately the owning page and masterpage again overrides this name to reflect the full id/name so i end up with the same wrong result. If you have no better solution than i posted, you are still very welcome to post your thoughts - atleast i'll know that my friend 'jack' is right about how messed up 'asp.net' is sometimes ;)

    Read the article

  • Html.RadioButton group defaulting to 0

    - by awrigley
    Hi A default value of 0 is creeping into a Surveys app I am developing, for no reason that I can see. The problem is as follows: I have a group of Html.RadioButtons that represent the possible values a user can choose to answer a survey question (1 == Not at all, 2 == A little, 3 == A lot). I have used a tinyint datatype, that does not allow null, to store the answer to each question. The view code looks like this: <ol class="SurveyQuestions"> <% foreach (SurveyQuestion question in Model.Questions) { string col = question.QuestionColumn; %> <li><%=question.QuestionText%> <ul style="float:right;" class="MultiChoice"> <li><%= Html.RadioButton(col, "1")%></li> <li><%= Html.RadioButton(col, "2")%></li> <li><%= Html.RadioButton(col, "3")%></li> </ul> <%= Html.ValidationMessage(col, "*") %> </li> <% } %> </ol> [Note on the above code:] Each survey has about 70 questions, so I have put the questions text in one table, and store the results in a different table. I have put the Questions into my form view model (hence Model.Questions); the questions table has a field called QuestionColumn that allows me to link up the answer table column to the question, as shown above (<%= Html.RadioButton(col, "1")%, etc) [/Note] However, when the user DOESN'T answer the question, the value 0 is getting inserted into the database column. As a result, I don't get what I expect, ie, a validation error. In no place have I stipulated a default value of 0 for the fields in the answers table. So what is happening? Any ideas?

    Read the article

  • Need help in radiobutton within gridview

    - by sumit
    Hi all, Thru radio button i am selecting the data from gridview. Here all radio buttons are selectable at a time. Actually it should not happen at a time user can select only one button which i could not do. My second problem is when i am selecting particular radiobutton that details should be displayed in text box. I have Itemid, ItemName, Quantity, Rate and Total field in gridview. These values i have inserted thru textbox so i have all the corresponding text box for all. So once i select particular radiobutton those details should be displayed in corresponding textbox. I have done the insertion coding for this but couldn't do selecting thru radiobutton and dispalying in textbox. Pls somebody help me in coding for this problem. Thanks, sumit

    Read the article

  • jQuery: How to grab RadioButton selection?

    - by Matt
    I need to grab the value of the radiobutton option selected with jQuery. I am using the following code but "str" is undefined in Firebug: //handling Feed vs. Ingredient RadioButton $('[id$=rdoCheck]').change(function() { str = $("input[name='rdoCheck']:checked").val(); //ingredients if (str == "ing") { $('[id$="lblDescription"]').text("Ingredient") } //finished feed else if (str == "ffc") { $('[id$="lblDescription"]').text("Finished") } });

    Read the article

  • Are there keyboard shortcuts for RadioButton and Checkbox?

    - by rlb.usa
    I have a lot of data-entryists using my ASP.NET application and we have all been wondering if there are any keyboard keys or shortcuts that you can press to trigger: Check a RadioButton Uncheck a RadioButton Check a Checkbox Uncheck a Checkbox I know that you can write Javascript and do it yourself, but do any keyboard keys/shortcuts already exist without using the mouse?

    Read the article

  • ASP MVC Set RadioButton From Database

    - by Jacob Huggart
    Hello All, I have what should be an easy question for you today. I have two radio buttons in my view: Sex: <%=Html.RadioButton("Sex", "Male", true)% Male <%=Html.RadioButton("Sex", "Female", true)% Female I need to select one based on the value returned from my database. The way I am trying to do it now is: ViewData["Sex"] = data.Sex; //Set radio button But that is not working. I have tried every possible combination of isChecked properties. I know that data.Sex is returning either "Male" or "Female". What do I need to do to check the appropriate radio button?

    Read the article

  • Getting a asp:radiobutton text in javascript?

    - by bala3569
    How to get a asp:radiobutton text in javascript? I use this RbDriver1.Text = dt.Rows[0].ItemArray[5].ToString(); RbDriver2.Text = dt.Rows[0].ItemArray[6].ToString() ; and my javascript function is function getDriverwireless() { alert(document.getElementById("ctl00_ContentPlaceHolder1_RbDriver1")); alert(document.getElementById("ctl00_ContentPlaceHolder1_RbDriver1").innerHTML); } innerHTML doesnt seems to take the text of my radiobutton...any suggestion When i inspect throgh firebug i found this <input type="radio" onclick="getDriverwireless();" value="RbDriver1" name="ctl00$ContentPlaceHolder1$drivername" id="ctl00_ContentPlaceHolder1_RbDriver1"> <label for="ctl00_ContentPlaceHolder1_RbDriver1">kamal,9566454564</label> I want to get the value kamal,9566454564 in javascript...

    Read the article

  • ASP.Net RadioButton loses ViewState

    - by Carl
    I'm having trouble with a simple radio set of two radio buttons (I don't want to use a RadioButtonList [RBL] because RBL doesn't allow child controls, and in my case, if you select one option, I want to enable a textbox next to the button; yes you could hack this with jQuery to move the textbox, but that's dirty!). I would check one, submit the form (either explicitly or through AutoPostBack), and the CheckedChanged event would never fire. When the page was reloaded, both buttons would be unchecked, regardless of their initial state on non-postback load or the state before form submission. I took out the checkbox and stripped this down to the simplest example I could come up with. I tossed EnableViewState=true all over the place just in case it was being disabled somewhere I couldn't find. <form id="form1" runat="server" enableviewstate="true"> <div> <asp:RadioButton ID="foo" Text="foo" runat="server" AutoPostBack="true" OnCheckedChanged="rbChanged" Checked="true" GroupName="foobar" EnableViewState="true" /> <asp:RadioButton ID="bar" Text="bar" runat="server" AutoPostBack="true" GroupName="foobar" OnCheckedChanged="rbChanged" Checked="false" EnableViewState="true" /> <asp:Label runat="server" ID="resultLbl" /> </div> </form> protected void rbChanged(object sender, EventArgs e) { if (foo.Checked) resultLbl.Text = "foo is checked"; else if (bar.Checked) resultLbl.Text = "bar is checked"; else resultLbl.Text = "neither is checked"; }

    Read the article

  • WPF RadioButton selected in UI, but seen by code as IsChecked == false

    - by Mike
    I have some radio buttons in a group box. I select the buttons randomly, and all works perfectly from a visual standpoint and also the event handler is called each time a new button is selected. Now I have a dependency property with a callback when the value changes. When in this callback procedure I read the IsChecked value of any button, the value is False, in spite the button is visually selected (they are all false at the same time, strange). The debugger also displays all buttons unchecked. Hu hu, I'm lacking ideas about the reason, after the basic verifications... <GroupBox> <StackPanel> <RadioButton x:Name="btNone" Content="Disconnected" IsChecked="True" Checked="OnSelChecked"/> <RadioButton x:Name="btManual" Content="Manual" Checked="OnSelChecked"/> </StackPanel> </GroupBox> Event handler: private void OnSelChecked(object sender, RoutedEventArgs e) { if (btManual.IsChecked == true) { // is called } } Dependency property: public static readonly DependencyProperty ManualProperty = DependencyProperty.Register("Manual", typeof(Position), typeof(SwitchBox), new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.AffectsRender, new PropertyChangedCallback(OnManualChanged))); Dependency property callback: private static void OnManualChanged(DependencyObject sender, DependencyPropertyChangedEventArgs args) { SwitchBox box = sender as SwitchBox; if (box.btManual.IsChecked == true) { // never true, why?? } }

    Read the article

  • jQuery RadioButton index

    - by Tomas
    Hello How to get checked RadioButton Index using jQuery? I need to read it and save to cookies to load status later using code $('input[name="compression"]')[{Reading from cookies code}].checked = true; 1<input name="compression" type="radio" value="1" checked="checked" /> 2<input name="compression" type="radio" value="2" /> 3<input name="compression" type="radio" value="3" /> Regards Tomas

    Read the article

  • mvc bind/post boolean to radiobutton

    - by Xuan Vu
    Hi all, I have a column in my Model with a NULLABLE boolean value. Now on my View (for editing), I would like to bind that to two radiobuttons: Yes & No. If the value is null, then just have the two radiobutton un-checked. How would I go to do that? Thanks.

    Read the article

  • Android: Where to find the RadioButton Drawable?

    - by Peterdk
    Ok, I am trying to create a custom view called CheckedRelativeLayout. It's purpose is the same as a CheckedTextView, to be able to use it in a list of items you want selected or in a Spinner. It's all working fine now, I extended RelativeLayout and implemented Checkable interface. However, I am stuck on a quite simple problem: Where can I find the Drawable that CheckedTextView and RadioButton use? I looked at the sourcecode of both, and they seem to use com.android.internal.R. Well... that's internal stuff. So I can't access it. Any way to get these Drawables or solve the problem somehow?

    Read the article

  • JQuery: show div on radiobutton select

    - by nav
    Hi, I am trying to use JQuery to show a div when the user selects a particular radio button (Other) within a radiobutton group. The html is below <div id="countries"> <input id="Washington_D.C" TYPE="RADIO" NAME="location" VALUE="Washington">Washington D.C</input> <input id="Other" TYPE="RADIO" NAME="location" VALUE="">Other</input> <div id="other locations" style="display: none"> </div> </div> Using the JQuery code: $(document).ready(function(){ $("radio[@name='location']").change(function(){ if ($("radio[@name='location']:checked").val() == 'Other') $("#county_drop_down").show(); }); }); But its not showing the div 'other locations' when I select the radiobutton'Other'....

    Read the article

  • WPF Radiobutton equivalent

    - by baron
    What is the WPF equivalent for WinForms radio button CheckedChanged? I have your basic 2 radio button set up, where when one is selected a textbox is enabled and when the other is selected it is disabled. For the time being I was using RadioButton_Checked, except, I set IsChecked true for one button in the xaml. When I reference the textbox in that Checked method it throws NullReferenceException... Let me know if you need code.

    Read the article

  • Winform radiobutton data binding

    - by Rajarshi
    I am following the "Presentation Model" design pattern suggested by Martin Fowler for my GUI architecture in a Windows Forms project. "The essence of a Presentation Model is of a fully self-contained class that represents all the data and behavior of the UI window, but without any of the controls used to render that UI on the screen. A view then simply projects the state of the presentation model onto the glass...." - Martin Fowler Read more about this pattern at www.martinfowler.com/eaaDev/PresentationModel.html I am finding the concept very fluid and easy to understand except this one issue of data binding RadioButtons to properties on the Data/Domain object. Suposing I have a Windows Form with 3 radio buttons to depict some "Mode" options as - Auto Manual Import How can I use boolean properties on Data/Domain Objects to DataBind to these buttons? I have tried many ways but to no avail. For example I would like to code like - rbtnAutoMode.DataBindings.Add("Text", myBusinessObject, "IsAutoMode"); rbtnManualMode.DataBindings.Add("Text", myBusinessObject, "IsManualMode"); rbtnImportMode.DataBindings.Add("Text", myBusinessObject, "IsImportMode"); There should be a fourth property like "SelectedMode" on the data/domain object which at the end should depict a single value like "SelectedMode = Auto". I am trying to update this property when any of the "IsAutoMode", "IsManualMode" or "IsImportMode" is changed, e.g. through the property setters. I have INotifyPropertyChanged implemented on my data/domain object so, updating any data/domain object property automatically updates my UI controls, that's not an issue. There is a good example of binding 2 radio buttons here - http://stackoverflow.com/questions/344964/how-do-i-use-databinding-with-windows-forms-radio-buttons but I am missing the link while implementing the same with 3 buttons. I am having very erratic behaviors for the Radio Buttons. I hope I was able to explain reasonably. I am actually in a hurry and could not put a detailed code on post, but any help in this regard is appreciated. There is a simple solution to this issue by exposing a method like - public void SetMode(Modes mode) { this._selectedMode = mode; } which could be called from the "CheckedChanged" event of the Radio Buttons from the UI and would perfectly set the "SelectedMode" on the business object, but I need to stretch the limits to verify whether this can be done by DataBinding.

    Read the article

  • Jquery-ajax parse xml and set radiobutton

    - by haltman
    hi everybody, I've a form with some radio button like this: <input type="radio" name="leva" value="a"><input type="radio" name="leva" value="b"> with ajax post method I receive value of the radio. The question is how can I set correct radio value to checked? thanks in advance ciao h.

    Read the article

  • radiobutton checked on condition in jquery

    - by RememberME
    I have the following fields: <label>Company Type:</label> <label for="primary"><input onclick="javascript: $('#sec').hide('slow');$('#primary_company').find('option:first').attr('selected','selected');" type="radio" runat="server" name="companyType" id="primary" />Primary</label> <label for="secondary"><input onclick="javascript: $('#sec').show('slow');" type="radio" runat="server" name="companyType" id="secondary" />Secondary</label> <div id="sec"> <fieldset> <label for="primary_company">Primary Company:</label> <%= Html.DropDownList("primary_company", Model.SelectPrimaryCompanies, "** Select Primary Company **") %> </fieldset> If there is a primary_company, then the secondary radio button should be selected. If there is no primary_company, then the primary radio button should be selected. Here is my jQuery: $(document).ready(function() { if ($('#primary_company').val().length > 0) { $('#secondary').attr({ checked: true }); } else { $("#primary").attr('checked', true ); $('#sec').hide(); } The sec div hides and shows properly, but a radio button is never selected. I've tried .attr('checked', 'checked') and .attr({ checked: true }) and .attr('checked', true) but nothing is ever selected.

    Read the article

  • Retrieve GWT radiobutton value in servlet

    - by Florian d'Erfurth
    Hi, I'm having a headache figuring how to retrieve the gwt Radio Buttons values in the server side. Here is my UiBinder form: <g:FormPanel ui:field="form"><g:VerticalPanel ui:field="fruitPanel"> <g:RadioButton name="fruit">apple</g:RadioButton> <g:RadioButton name="fruit">banana</g:RadioButton> <g:SubmitButton>Submit</g:SubmitButton> ... Here is how i initialize the form: form.setAction("/submit"); form.setMethod(FormPanel.METHOD_POST); So i though i would have to do this on the servlet: fruit = req.getParameter("fruit") But of course this doesn't work, parameter fruit doesn't exist :/ Edit: Ok i get parameter fruit but it's always "on" I also did try to add the radio button in java with: RadioButton rb0 = new RadioButton("fruit", "apple"); RadioButton rb1 = new RadioButton("fruit", "banana"); fruitPanel.add(rb0); fruitPanel.add(rb1); So how should i do?

    Read the article

  • When radio button selection changes do not cause refresh?

    - by JPJedi
    When the selection of the radio buttons change I would like to show/hide the panel in the next table cell. I have it hiding and showing fine but each time it causes the page to refresh to the top. Is their a way to stop that refresh? I would like to hide and show the panel dynamically. <table> <tr> <td> <asp:RadioButtonList runat="server" ID="rblPlayerStatus" AutoPostBack="true" > <asp:ListItem>Free Agent</asp:ListItem> <asp:ListItem>I have teammate</asp:ListItem> </asp:RadioButtonList> </td> <td> <asp:Panel runat="server" ID="pnlTeamMate"> <asp:Label runat="server" ID="lblTeamMate" Text="Choose Teammate" /> </asp:Panel> </td> </tr> </table>

    Read the article

1 2 3 4 5 6 7 8 9 10 11  | Next Page >