Drop Down Firing Wrong Event?
Jan 4, 2011
I'm using VS 2010, .net 4, vb.net. I have an asp.net site and on a page have 2 drop down lists.
<asp:DropDownList ID="ddlClassIndex" runat="server" AutoPostBack="true" />
<asp:DropDownList ID="ddlClassQBankList" runat="server" AutoPostBack="true" />
When the page first loads i can click on either of these, select an item and the event fires correctly. When i select either of the drop down boxes as a second operation, the first drop down, ddlClassIndex.SelectedIndexChanged fires. What have i done wrong that this would be happening. I do a page.ispostback=false check when the page loads and we are also using master pages.
Private Sub LoadClass()
Dim Os As List(Of Dempsey.OldeTestClassIndex) = Nothing
Dim Oc As New Dempsey.OldeTestClassIndex_Controller
Os = Oc._GetClassIndexData(0)
Dim X = From w In Os
Where w.Active = 3
Select w
Os = X.ToList
With Me.ddlClassIndex
.DataSource = Os.OrderBy(Function(o) o.ClassTitle)
.DataTextField = "ClassTitle"
.DataValueField = "tblClassIndexID"
.DataBind()
.Items.Insert(0, New ListItem("Choose Class Title", "0"))
.SelectedIndex = 0
End With
End Sub
Protected Sub ddlClassIndex_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddlClassIndex.SelectedIndexChanged
If Me.ddlClassIndex.SelectedIndex > 0 Then
If ClassHasCategories(Me.ddlClassIndex) = True Then
Response.Redirect("AddEditQBank.aspx?ClassIndexID=" & Me.ddlClassIndex.SelectedItem.Value)
Else
Me.lblStatus.Text = "No Categories"
Me.lblStatus.Visible = True
End If
End If
End Sub
Private Sub LoadClassQBankList()
Dim ary As New ArrayList
ary.Add(1)
ary.Add(2)
ary.Add(3)
Dim Os As List(Of Dempsey.OldeTestClassIndex) = Nothing
Dim Oc As New Dempsey.OldeTestClassIndex_Controller
Os = Oc._GetClassIndexData(0)
Dim X = From w In Os Join l In ary On w.Active Equals l
Where w.KT = 1 And w.RandomTest = 1
Select w
Os = X.ToList
With Me.ddlClassQBankList
.DataSource = Os.OrderBy(Function(o) o.ClassTitle)
.DataTextField = "ClassTitle"
.DataValueField = "tblClassIndexID"
.DataBind()
.Items.Insert(0, New ListItem("Choose Class Title", "0"))
.SelectedIndex = 0
End With
End Sub
Protected Sub ddlClassQBankList_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddlClassQBankList.SelectedIndexChanged
If Me.ddlClassQBankList.SelectedIndex > 0 Then
Response.Redirect("ClassQBankList.aspx" & "?ClassIndexID=" & Me.ddlClassQBankList.SelectedValue)
End If
End Sub
~~~~~~~~~~
More info
I am checking for page postback. When i select from the drop down, it redirects to a different page. When i click the back button and selected another value in the other drop down, both SelectedIndexChanged fire. So i do i need to do something with viewstate? before i redired to the other page?
View 1 Replies
Similar Messages:
Apr 27, 2010
This is realy simple, basic functionality, but for some reason it's not working.
[Code]....
When I debug I notice that the event never is fired.
View 5 Replies
Aug 12, 2010
I have a text box and many buttons. When user is in some text box and presses the "enter" key then specific button click event is raised. I read on the internet that there are some problems with the "enter" key and I tried few solutions but still it always enters that button event (that button is the first button in the page).
I tried creating a button which does nothing and writing this in the page_load:
idTextBoxFA.Attributes.Add("onkeydown","if(event.which || event.keyCode){if ((event.which == 13) || (event.keyCode == 13)) {document.getElementBtId('" + noEnterButton.UniqueID + "').click();return false;}} else {return true}; ");
All my page controls are in a form and I tried giving the form "defaultButton" property to that button I created. That didnt work either.
View 1 Replies
Feb 1, 2010
I have a web page which contains 3 drop down boxes followed by 3 textboxes. I am implementing Required field validators for all of them . But when i hit submit , The Page first checks for empty Textboxes before checking for any value in Drop down boxes , but i want the Drop down boxes to be validated first before Textboxes. How Can it be achieved?
View 1 Replies
Aug 1, 2010
I have a weird thing happening. I have two identical databases installed on one virtual machine but under two different instances of SQLServer. For some reason, periodically when saving from one it will save to the other instead. Using debug, I have verified that the connection string is correct and when the item saves, it still saves to the wrong database.I use session variable, and am of the belief that it might have something to do with it...and t hat when I go from one to the other it is still getting the connection string form the other for some reason.To make sure that it isn't a problem, I make sure that I completely close out one database before opening the other in a new IE window.I assume that when I completely close out an internet explorer window that it abandons all session states. Is that true?
View 7 Replies
Jan 22, 2010
I'm sure I'm missing something extremely obvious here, but at this point I can't see it so I need the help.Anyway, I've got a repeater inside of an UpdatePanel. As of right now, I've stripped it down to this, just to try and isolate the problem:
[Code]....
Whether I add the handler during itemdatabound or I add the handler within the repeater itself, it doesn't seem to matter...the event itself doesn't fire. The AutoPostback itself seems to fire, but the event itself doesn't.
View 3 Replies
May 29, 2010
I am developing a C# / SQL website application in VS 2008 and using SQL Server 2008. I am a newbie. Right now though I can not get the drop-down box to display the SQL table columns. This application should return all of the rows from the selected table. And then I append one row = IGNORE to the end of the list. But when I run this app the first time, it correctly displays the list of available values from the table and appends IGNORE on the end. However, after postback it only displays IGNORE value for me to select. I thought this might be a Viewstate or Autopostback problem, but I tried changing these values and it did not fix it. Here are excerpts from my code.
The problem is that the "targettable" variable is null after postback. But I don't see what is causing this.
[Code]....
View 12 Replies
Mar 11, 2010
ASP.Net Dropdownlist , on changing the value of drop down list and clicking the button it is not sending an upadted value to the New.aspx
[code]....
View 5 Replies
Mar 1, 2011
I have a gridview called gvResults. In the gvResults_RowEditing event I add a row below the one selected. In that new row, which spans all columns, I insert a user-control. There are two buttons and some textboxes in the user control.
My problem is that when I click one of the user-control buttons it never gets to the button event handler, I think because the user control is not recreated on the page postback. How can I have the user-control events fire before the parent page events fire?
I tried using an update panel, but I still get the parent posting back before the user-control events.
View 3 Replies
May 8, 2010
I am facing one strange problem,I have a gridview in which the last two columns have checkboxes and on those checkboxes click event I am doing some database operations.I also have one checkbox that is outside the gridview which actually shows or hides some of the gidview columns.This was all working well but now I have shifted that grid to a user control because I have to use it in two pages.The problem now is,When the page first loads and I click the check box or any control in the page that is outside the grid then it works perfectly.But once I click any of the check box within grid view column then its behavior chages, now even if I click the checkbox that is outside the grid then also the checkbox_CheckedChanged event of the checkbox that is whithin gridview is fired.That checkbox event then behaves something like a page_load event that is called for every page load and for every event with in the page after it is called once.
View 3 Replies
Jul 27, 2010
I have a page with simply a heading with logo image that is sensetive to click and redirects page to other page. in the middle page I have two text boxes to enter login information, whenever I push enter after filling each textbox it fires the event of logo and redirects to other page. Any kind of setting on page should be done? does page have any default event for enter key? how can I change that?
View 5 Replies
Jan 12, 2011
I have two search textboxes and two corresponding buttons on my web page.One of the textboxes is a default textbox coming from the .master page and the other one is local to the page.Now,when I enter some text into the local textbox and press enter, the event of the master page button gets fired instead of that of the local button.How do I fix this issue? I tried to shift focus to the local button and on the text changed event but the master page button event is always the last one which is getting fired. I tried changing both the buttons to LinkButtons but then enter doesn't work!A
View 2 Replies
Aug 6, 2010
I have a few sections in my code with a button to do something different in each. I'm pretty sure the user would press enter to submit the section, but I would like to handle it nonetheless.To handle it, I put the "sections" into Panels, and set the default button for each. There is a total of 4 panels and default buttons set to their respective included buttons.When I press enter in 3 of them, the correct event fires, but not in one (it calls a different button).I put MsgBoxes (for testing) at the beginning of each server event to see which is being called, and it's not the correct one.I might as well post the code, but it's fairly simple. I don't know if the accordion affects it at all, but it doesn't seem like it should...
[Code]....
Sorry, I hate when people post way too long code, but most of it doesn't exactly apply, so just focus on the panels.When I press enter when in focus in on a textbox in BudgetReportsPanel2 and press enter, the
UpdateButton event is called instead.
View 4 Replies
Aug 1, 2010
I have a very weird thing happening. I have two databases that have exactly the same tables but different database names on the same virtual machine, but in different instances of SQL Server. For some reason, when using one of them, it will save to the other. In debug, looking at my connection string..I have verified that it is correct, yet when I allow the save, I look in the table and it isn't there, it is in the other database that is in a table with a completely different name and in a different instance of SQL Server.
View 1 Replies
Sep 10, 2010
I have a page containing a datagrid, which works. On that page I have a button which is supposed to trigger a download of the data from the datagrid in Excel format. However, the button isn't firing the event. The C# code-behind I have is:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using umbraco;
namespace MyDataExport
{
public partial class DataExport : System.Web.UI.UserControl
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
GridView1.DataSource = BindData();
GridView1.DataBind();
[Code....]
View 1 Replies
Jul 22, 2010
I have a grid view within that i have child gridview,one coloumn of child gridview is bound to check box all thease are in update panel,
i have made checkbox autopostback="true",but check_changed() event is not firing
View 1 Replies
Feb 10, 2011
I am using Ext.Net and I have a problem.
I am creating dynamic buttons. It is working but if i click, the button event is not working.:(
My code:
foreach (var events in eventsInformation)
{
Ext.Net.Button btn = new Ext.Net.Button();
btn.ID = events.EvtId.ToString();
btn.Text = events.EvtName;
btn.Click += new EventHandler(Tickets_click);
ViewPort1.Controls.Add(btn);
}
View 2 Replies
Apr 4, 2010
I am using asp:menu.In this asp menu,on clicking menu item,I want to get the menuitem,and its parent.I tried to use menuitemclick event.But menuitemclick event is not firing on clicking menu item.
View 1 Replies
Mar 21, 2010
In tab container let say I have two tabs [Tab1 & Tab2] Tab1 has 2 text box with required field validator Tab2 has 3 text box with required field validator Now even if I am filling all the text boxes in the TAB1, it is not allowing me to postback. [because TAB2 text boxes are still empty] & When I am filling all the textboxes [Both Tab1 & Tab2], button is firing correctly. I mean user has to fill details for the TAB1 & can submit the details. At that Time I don't want TAB2 validations to work.
View 1 Replies
Jan 6, 2011
I've stepped through the code and verified this action. It gets to the end sub and just loops again. Also does it on the production server in IE and Chome (that's all I've tried). Here is the button definition on the actual ASP page:
[Code]....
It goes through the code, sends me an email, gets to End Sub, then loops right back to the top of the sub and goes through the whole thing again, sending me a duplicate email, then exiting normally and sending them to the About page. This is the only code in the aspx.vb besides the class def and inherits statement.
View 2 Replies
Nov 4, 2010
I have a gridview with rows of data and a group of radio buttons for each row that can be selected. But when selected the event never fires for the radio dropdown.... why?
[code]....
View 2 Replies
Apr 6, 2010
when the user comes out of a texbox, i need to read the text entered in the textbox.
I tried using the textchanged event. But it is not firing when i move out of the textbox.
View 7 Replies
Jul 23, 2010
I put a break point at the protected void Page_Load(object sender, EventArgs e) method of my master page, but when i start the site it does not hit that break point.
Why is the event not firing? I would like to use this event along with others such as the Init event in order to check to see if the session has expired everytime a page loads...
View 4 Replies
Mar 1, 2011
I have a GridView, which features a a checkbox on each row (in a template field), where it calls a method upon checked changed (well, when they click submit - no auto post back)
My problem is, the checked change refuses to fire more than once - if I just change the check state of one checkbox in the grid, it works fine. More than one and it only fires the event once.
EDIT: Bit of code:
<asp:CheckBox ID="chkIncludedLocal" runat="server" Checked='<%# Bind("Included") %>'
Enabled="true" OnCheckedChanged="chkIncludedLocal_CheckedChanged" />
And in the event, I put a breakpoint right at the top to see how many times it fires
View 1 Replies
Jun 8, 2010
The OnSelectedIndexChanged event is not firing for my dropdown box. All forums I have looked at told me to add the AutoPostBack="true", but that didn't change the results.
HTML:
[code]....
View 2 Replies