Sort A Gridview Once A Radio Button Is Selected?

Mar 25, 2010

I'm trying to sort records in the gridview right after a radio button is selected. My approach is with the dataview, but because the dataset variable doesn't survive a round trip to the server, I don't know how to make this happen.

Public Sub GetCustomers()
db.RunProcedure("usp_customers_get_all")
db.doSort(radList.SelectedValue)
gvCustomers.DataSource = db.MyView
End Sub
Protected Sub radList_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles radList.SelectedIndexChanged
If radList.SelectedValue = 0 Then
db.doSort(0)
gvCustomers.DataSource = db.MyView
End If
If radList.SelectedValue = 1 Then
db.doSort(1)
gvCustomers.DataSource = db.MyView
End If
End Sub
Public Sub doSort(ByVal strIn As Integer)
If strIn = 0 Then
MyView.Sort = "lastname, firstname"
Else
MyView.Sort = "username"
End If
End Sub
Public Sub RunProcedure(ByVal strName As String)
Dim objConnection As New SqlConnection(mstrConnection)
Dim mdbDataAdapter As New SqlDataAdapter(strName, objConnection)
Try
mdbDataAdapter.SelectCommand.CommandType = CommandType.StoredProcedure
Me.mDataset.Clear()
mdbDataAdapter.Fill(mDataset, "tblCustomers")
MyView.Table = mDataset.Tables("tblCustomers")
Catch ex As Exception
Throw New Exception("stored procedure is " & strName.ToString & " error is " & ex.Message)
End Try
End Sub

View 1 Replies


Similar Messages:

Data Controls :: Sort GridView Based On Column Name Specified In Selected Radio Button

Jan 4, 2013

i need to sort the gridview based on the radiobuttons. and i have 3 radiobuttons like dept,empcode,reporter..

if i click on any of radiobutton i need to show the gridview by sorting order..

View 1 Replies

Looping Through Each Group Of Radio Buttons And Getting The Text Of The Selected Radio Button?

Mar 21, 2010

i have a table which looks something like the following

<table id="Table1" border="0">
<tr>
<td><b>1.</b> Question 1</td>[code]....

how do i go about looping through each group of radio buttons and getting the text of the selected radio button ?the code displayed above is created dynamically ... in my aspx file i have the following code

<asp:Table ID="Table1" runat="server">
</asp:Table>

View 3 Replies

Forms Data Controls :: Radio Button Selected Value In A Gridview?

Jan 19, 2010

I have a Gridview with Radiobutton selection and two text boxes and two buttons.

What i need is to like search and extract functions.

My Gridview Initially contains all the data in the table. In one text box, like if i want to search "Learning" in column FIRST NAME and i type "L" in the text box and click the button, all values from the column FIRST NAME starting from "L" should be listed in the Gridview, so that from there user can select "Learning" and click another button to extract values corresponding to it in the another Textbox.

My Gridview looks like this :

[Code]....

View 12 Replies

Forms Data Controls :: Radio Button In Gridview Not Storing The Selected Value

Sep 20, 2010

i have a grid view with radio button...schedule/approve/reject...by defualt schedule radio button is selected....but when i chage radio button selection option to anyth other than schedule it still store only schedule in DB.wats the pblm?

[Code]....

[Code]....

when i click submit button i got this error

Invalid postback or callback argument. Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.

so i set the enableeventvalidation=false

now i dint receive any error but when i set breakpoint on the funtion which called on buton clik it still got the value as scheduled for the radio button..spent almost half day for this.. all this while this was workin after i add the moralpopupextender am facing this pblm...now i tried removin that extender but still pblm exist.

View 5 Replies

MVC :: Get The Selected Radio Button?

Jan 26, 2011

i have a view wich gets in its model (among other things!) a string with the name of partialView to be rendered in a certain div.

well, in that partial view there are two radion buttons, with the same name but diferent id's and values.

when i submit the form in the view, wich also has the partialView controls (radio bts), in the respective controller i get inside a formcollection an item with both values of the radio buttons,

my question is, how can i find wich one was selected in the view?

View 3 Replies

Web Forms :: How To Get Selected Value In Radio Button

Aug 4, 2010

i have a web page in which i place radio button list, when i select any radio button, on printing i get light color for selected radio button, how i get selected radio button dark colour so that it can visible easily..

View 13 Replies

AJAX :: Open Modal Popup And Keep The Radio Button Selected?

Mar 22, 2011

I 've a form in the parent page with many form elements.

I've 2 radio buttons with values "Yes" and "No". I am opening a modal popup when clicked on "Yes" radio button. The modal popup is opening fine.

But when I click "Yes", it' s not selected. After modal popup is closed, when I return to parent page, the option "Yes" is still not selected.

How to make it selected when clicked and open popup?

Part of my aspx code is below

[Code]....

View 5 Replies

Web Forms :: How To Access The Selected Item From The Radio Button List

Jan 11, 2011

I'm trying to figure out how to access controls that are added to a panel in a code behind file.For example, when I click a button, I add a radio button list to the panel.How do I access the selected item from that radio button list? I get an error saying it is not defined, even though list gets generated..

View 4 Replies

C# - How To Call Function When The Selected Index Changes In Radio Button List

Mar 21, 2010

I have a table in my form, where I put n-rows, every row contains 1 RadioButtonList, when user select the item in RadioButtonList, I need to get the index of selected Item, without updating the page

View 2 Replies

Web Forms :: Insert Radio Button Selected Item To Database

Jun 30, 2012

I have 2 radiobutton  

1 text box and   1 button

radiobutton1

radiobutton2

And this is my table

price name Id 

View 1 Replies

Web Forms :: Store Selected Option From The Radio Button List To Database?

Jan 26, 2011

Im doing a project which requires me to store the survey results to database.

For the options, I am using the radio button list.

However, I have problems storing the selected option back to database.

Is there any solution to it? Im using visual studio C#! :)

View 5 Replies

JQuery :: Post The Form And Use The Value Of The Hidden Field To Know The Selected Radio Button

Sep 24, 2010

I'm having a time finding out I could not do something simple as :

On the onchange event getting the new selected checkbox, this with jquery.

The checkboxes are located in the following div :

[Code]....

This all located in a form, when I will find out the selected radio on change I will post the form and use the value of the hidden field to know the selected radio button. Nothing really difficult.

The js code :

[Code]....

View 3 Replies

Web Forms :: Assigning Selected Item Of Radio Button List In Code Behind?

Mar 3, 2010

Since setting item.selected to true will lose the mutual behavior and setting list.SelectedValue (readonly) doesn't get any button selected.

I am using list.SelectedIndex to assign the selected button. as follow :

//step 1. find the item by value
ListItem item = list.items.FindByValue(obj.ToString());
//step 2. find the item index
list.SelectedIndex = list.Items.IndexOf(item);

I make it into an extension method. But feel stupid about this procedure to simply just assign a selected value. does anyone have a better approach?

View 5 Replies

Web Forms :: Radio Button Selected Indexed Changed Event Not Firing?

Oct 7, 2010

I have two pages ,On click on one button I have to redirect the screen to another page.and after clicking on redirect button page will get redirected to old page.

Problem: while coming to old page i have to set one radio button selected amnog two.I have acheived it through session.But the problem,is after coming back once i selected the radio button which is not selected. its not firing the selected index changed event.

View 2 Replies

Set Previously Selected Radio Button Checked In Classic After Page Is Postbacked?

Jun 9, 2010

I have never worked on classic ASP and unfortunately i am supposed to modify an old classisc ASP web site.

ASP.Net ViewState does take care of maintaining control's sate automatically. How do i do it in classic ASP ?

I have two radio buttons and a text box placed on my ASP page, when user types in something in the text box based on radio button selection we display different search results. Now what i need is to keep the previously selected radio button as checked after the page is postbacked. How do i do that ?

View 1 Replies

Web Forms :: Show Grid View On Only Some Selected Radio Button List Item?

Jun 15, 2010

I want to show grid view on only some selected radio button list item , how can i do this i am using this but it is not working..

<asp:RadioButtonList ID="RadioButtonList1" runat="server" RepeatColumns="4" RepeatDirection="vertical" OnSelectedIndexChanged="RadioButtonList1_SelectedIndexChanged" OnTextChanged="RadioButtonList1_TextChanged">
<asp:ListItem Text="Convention Center"></asp:ListItem>
<asp:ListItem Text="Conference Hall"></asp:ListItem>
<asp:ListItem Text="Auditorium"></asp:ListItem>
<asp:ListItem Text="Hotel/Resort"></asp:ListItem>
<asp:ListItem Text="Party Lawn"></asp:ListItem>
<asp:ListItem Text="Spa Resort"></asp:ListItem>
</asp:RadioButtonList>
------------------------------------------------------
protected void RadioButtonList1_TextChanged(object sender, EventArgs e)
{
If (RadioButtonList1.SelectedItem.Text == "Convention Center" || RadioButtonList1.SelectedItem.Text == "Conference Hall" || RadioButtonList1.SelectedItem.Text == "Auditorium" || RadioButtonList1.SelectedItem.Text == "Party Lawn")
{
GridView1.Visible = true;
}
else
{
GridView1.Visible = false;
}
}

View 2 Replies

Web Forms :: Make A Label React To A Radio Button List Selected Index

May 31, 2010

I'm learning asp.net and c#, and can't figure out why this won't work for me.I'm using a label control and a radiobutton list control. Basically if you select radio button 1 I want the label to say radio button one , radio button 2 for the next one and so on. Here is the code I thought would work.

[Code]....

View 1 Replies

Forms Data Controls :: Access Radio Button List Selected Value From Repeater Control?

Dec 29, 2010

I have a user control (this has a label to display question and a radio button list to show options).

I am using this user control inside a repeater to display all the questions with their options.

In my repeater page I am not able to capture SelectedValue of radio button list.

protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)

View 4 Replies

Forms Data Controls :: Radio Button List Inside Gridview - Push A Button To Submit The QuestionID

Jul 24, 2010

I have a databound Gridview (with a LINQ datasource). The gridview displays questions from the SQL DB to the user. I've inserted a radio button list into the gridview with 3 horizontal radio buttons with fixed values of 1,2,3 for the user to select. I have a question ID, a tempuserID, and AnswerValue columns set up in the database. It all works nicely.

After the user selects radio buttons, I would like for them to push a button to submit the QuestionID, the associated Radio Button Value (AnswerValue) and their tempUserID into the DB. How do I do this? I'm not sure what to do next and what VB/LINQ code to put in the code behind file in the button click event handler. I'm also not sure on what to use for the tempUserID, can I use the sessionID? I'm using VB and here's my code:

[Code]....

View 15 Replies

Forms Data Controls :: Merge And Sort Selected GridView Cells

Apr 9, 2010

I have a GridView known as GV_R001 with IssueType, ActID, IssueID cells. I want to Merge the similar IssueType cell accordingly. How do i merge and also sort the IssueType cell accordingly. The following is my codes:

Protected Sub GV_R001_DataBound(ByVal sender As Object, ByVal e As System.EventArgs) Handles GV_R001.DataBound
For rowIndex As Integer = GV_R001.Rows.Count - 2 To 0 Step -1
Dim gvRow As GridViewRow = GV_R001.Rows(rowIndex)
Dim gvPreviousRow As GridViewRow = GV_R001.Rows(rowIndex + 1)
Dim cellCount As Integer = 0
If gvRow.Cells(cellCount).Text = gvPreviousRow.Cells(cellCount).Text Then
If gvPreviousRow.Cells(cellCount).RowSpan < 2 Then
gvRow.Cells(cellCount).RowSpan = 2
Else
gvRow.Cells(cellCount).RowSpan = gvPreviousRow.Cells(cellCount).RowSpan + 1
End If
gvPreviousRow.Cells(cellCount).Visible = False
End If
Next
End Sub

Apart from that, after sorting i want to calculate the amount of IssueID are in a particular IssueType and display in a cell called "Total". Is it possible to do so? By the way, I am using Web Developer 2008, VB.net.

View 2 Replies

Web Forms :: How To Select Only One Radio Button And Radio Button Validation

Mar 2, 2011

I've two radio buttons in my web site for selecting sex, one s for Male & another s for Female, Problem is during the Run time, I was able to select both the Radio Buttons, but as per my need i should select only one radio button. And i should perform validation Wn user not selected even one radio button i should show the error msg, like " select sex "

View 8 Replies

Forms Data Controls :: RadioButtonList, Gridview, TemplateColumn, Get Selected Radio Value In VB

Nov 28, 2010

[Code]....

VB.Net

[Code]....

RadioButtonList, Gridview, TemplateColumn, get selected radio value in VB

View 2 Replies

Forms Data Controls :: Gridview Sort Manually With Button Outside Of Gridview?

Jan 18, 2011

I have a gridview with data. I want a button which is not part of the gridview. Then if I press a button the gridview is sorted by two colums. i.e column1 ascending column2 descending.

I am not looking to work with a Sqldatasource as I use a data access layer. So the sort would have to be from a datatable and databind or directly with the gridview.

View 3 Replies

Checking A Radio Button With JQuery When Radio Button Is Runat="server"?

Aug 10, 2010

Using jQuery I want to be able to click an element which will also checks it's related radio button. I had this working fine until we had to add runat="server" to the radio buttons.When I apply this it prevents my jQuery function from working how to get round it, heres a simplified version of the code:HTML

<input type="radio" runat="server" id="sector1Radio" name="SectorGroup" title="Sector1" />

jQuery

$('#SomethingElse').click(function() {
$('input[title=Sector1]').attr('checked','checked');
});

I've found out that when its converted to a .net control instead of checked="checked" (as it would be usually) it is just Checked, so I changed that but on inspecting the DOM in multiple browsers, none of my radio buttons are being checked(Are there any other ways I can use jQuery to check a radio button that has runat="server"?

View 9 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved