SelectedIndexChanged To Open A New Form / Not Working

Mar 18, 2011

I have a web page with a datagridview where a user should be able to click on the selectindexchanged (in this case a "Select" button) show the results of what they have selected in a label on the second page and also redirect them to that page. Here is the code I have for the vb.net:

Imports System.Data.SqlClient
Imports System.Data
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
TimeDateLabel.Text = String.Format("Today is {0:F}", DateTime.Now)
TextBox1.Focus()
End Sub
Protected Sub whosoncallButton_click(ByVal sender As Object, ByVal e As System.EventArgs) Handles whosoncallButton.Click
Dim dt As New DataTable
Dim da As New SqlDataAdapter
Dim cmd As New SqlCommand
Dim connectionString As String = "Initial Catalog=mdr;Data Source=xxxxx;uid=xxxxx;password=xxxxx"
Dim con As New SqlConnection(connectionString)
con.Open()
cmd.Connection = con
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "getoncall"
cmd.Parameters.AddWithValue("@subschedule", TextBox1.Text)
Try
da.SelectCommand = cmd
da.Fill(dt)
GridView1.DataSource = dt
GridView1.DataBind()
con.Dispose()
Catch ex As Exception
Response.Write("Error:" & ex.Message)
End Try
End Sub
Protected Sub clearButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles clearButton.Click
TextBox1.Text = ""
GridView1.DataSource = Nothing
GridView1.DataBind()
End Sub
Protected Sub GridView1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles GridView1.SelectedIndexChanged
Dim row As GridViewRow = GridView1.SelectedRow
Response.Redirect("Default2.aspx?msg=" + row.Cells(1).Text)
End Sub
End Class

I have also added a line to my aspx page for the event handler.

I have debugged this but no matter what I've tried so far, the SelectIndexChanged event isn't firing.

View 2 Replies


Similar Messages:

SelectedIndexChanged To Open New Form

Mar 25, 2011

I have a datagrid view on a page that I'm making and I want to be able to open another form when a user "selects" an entry. I've tried looking through the documentation on how to do that but can't seem to find any. Does anyone know of an easy way to accomplish this task?

Imports System.Data.SqlClient
Imports System.Data
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
TimeDateLabel.Text = String.Format("Today's date is {0:F}", DateTime.Now)
End Sub
Protected Sub whosoncallButton_click(ByVal sender As Object, ByVal e As System.EventArgs) Handles whosoncallButton.Click
Dim dt As New DataTable
Dim da As New SqlDataAdapter
Dim cmd As New SqlCommand
Dim connectionString As String = "Initial Catalog=mdr;Data Source=xxxxx;uid=xxxxx;password=xxxxx"
Dim con As New SqlConnection(connectionString)
con.Open()
cmd.Connection = con
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "getoncall"
cmd.Parameters.AddWithValue("@subschedule", TextBox1.Text)
Try
da.SelectCommand = cmd
da.Fill(dt)
GridView1.DataSource = dt
GridView1.DataBind()
con.Dispose()
Catch ex As Exception
Response.Write("Error:" & ex.ToString)
End Try
End Sub
Protected Sub clearButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles clearButton.Click
TextBox1.Text = ""
GridView1.DataSource = Nothing
GridView1.DataBind()
End Sub
Protected Sub GridView1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles GridView1.SelectedIndexChanged
End Sub
End Class

and what I'm trying to do is that when users click on the SelectedIndexChanged that it takes them from this form with the item that was selected carried through to the next form, and opening a form called messageform.aspx.vb.

View 1 Replies

Forms Data Controls :: SelectedIndexChanged To Open A New Form?

Mar 16, 2011

I have a datagrid view on a web page that I'd like to be able to have a user "select" an item and then open another page. I've tried looking through some online documentation, but I haven't found a really efficient way to do what I want yet.

Here is my code so far:

[Code]....

View 2 Replies

Forms Data Controls :: SelectedIndexChanged To Open Another Form?

Mar 11, 2011

I have a datagrid view on a page that I'm making and I want to be able to open another form when a user "selects" an entry. I've tried looking through the documentation on how to do that but can't seem to find any.

View 13 Replies

AJAX :: SelectedIndexChanged Event Not Working When Using CascadingDropDown

May 7, 2015

I have two dropdownlist in cascading using a web service, all is cool, but the problem is how use the method onselectedindexchanged in the second dropdownlist, method onselectedindexchanged in second dropdownlist don't work, how could i use method selectedindexchanged in web service?

View 1 Replies

Web Forms :: When Load The Form / Combobox SelectedIndexChanged Event Is Firing Automatically

Feb 17, 2011

I am using 2 combobox , In form_load event i am loading the combobox using dataset and In selectedIndexChanged event of the combobx1 we have to load combobox2

I am having a problem that when i load the form, combobox selectedIndexChanged event is firing automatically So how can i avoid this.

I understand that if it's a web application then IsPostBack method will be useful, but what to do as it's a windows (desktop) application.

View 2 Replies

Web Forms :: Dropdownlist Selectedindexchanged Event Working Slow In Ie8

Jan 8, 2011

i am using dropdownlist selectedindexchanged event , it is working with good speed in ie 6 or ie 7. But working slow in ie8.

View 2 Replies

Web Forms :: Drop Down List SelectedIndexChanged Not Working Correctly

Feb 2, 2010

I've got a form with 3 drop down lists. If I choose a report on the Actions DDL, which displays a sql report as a pdf, then select an item in one of the other DDL's, the SelectedIndexChanged event for the Actions DDL is fired again. I can't get the other DDL's SelectedIndexChanged event to fire.

[Code]....

View 1 Replies

Web Forms :: SelectedIndexChanged Event Of Drop Down List Not Working?

May 18, 2010

i n using java script function to showalert msg .function is as follows

function ShowAlertForScaleResolution()
{
var ddlScale= document.getElementById('<#=ddlScale.ClientId #>');
var ddlResolution= document.getElementById('<#=ddlResolution.ClientId #>');
if(ddlScale.value=="0" || ddlResolution.value=="0")
{
alert("Please select valid Scale and Resolution");
}
return false;
}

my dropdown source code is--

<asp:DropDownList ID="ddlBlockName" onchange="return ShowAlertForScaleResolution();"
runat="server" Width="150px" AutoPostBack="True" OnSelectedIndexChanged="ddlBlockName_SelectedIndexChanged">
</asp:DropDownList>

when i m selecting the BlockName withought selecting any item from ddlScale and ddlresolution then i m showing alert msg.

My Problem is that when i m selecting the details of scale and resolution dropdown then its not showing any errormsg. But its not firing the selected index chaged event of Drop down .

View 2 Replies

Web Forms :: Dropdownlist Selectedindexchanged Not Working With Autopostback = True

Jan 19, 2010

i have two dropdownlist in my webform both are filled dynamically in the page_load event

[Code]....

View 8 Replies

Forms Data Controls :: DropDownList.SelectedIndexChanged Not Working

Nov 11, 2010

I have the following in a web user control:

asp:DropDownList
ID="ddlPrescriptionCodeGroup"
runat="server"
AppendDataBoundItems="True"
AutoPostBack="True"
DataSourceID="PrescriptionCodeGroupDataSource"
DataTextField="CodeGroupDescription"
DataValueField="PrescriptionCodeGroupID"
onselectedindexchanged="ddlPrescriptionCodeGroup_SelectedIndexChanged">
<asp:ListItem
Text="--Please Select--"
Value="-1"></asp:ListItem>
<
</asp:DropDownList>
<asp:SqlDataSource
ID="PrescriptionCodeGroupDataSource"
runat="server"
ConnectionString="<%$ ConnectionStrings:RadiotherapyConnectionString %>"
SelectCommand="SELECT [PrescriptionCodeGroupID], [CodeGroupDescription] FROM [PrescriptionCodeGroup] WHERE (([Archived]
= @Archived) AND ([OrganisationID] = @OrganisationID))">
<SelectParameters>
<asp:Parameter
DefaultValue="False"
Name="Archived"
Type="Boolean"
/>
<asp:SessionParameter
Name="OrganisationID"
SessionField="OrganisationID"
Type="Int32"
/>
</SelectParameters>
</asp:SqlDataSource>
<asp:DropDownList
ID="ddlPrescriptionCode"
AutoPostBack="True"
runat="server"
AppendDataBoundItems="True"
onselectedindexchanged="ddlPrescriptionCode_SelectedIndexChanged"
DataSourceID="PrescriptionCodeDataSource"
DataTextField="CodeDescription"
DataValueField="PrescriptionCodeID"
>
<asp:ListItem
Text="--Please Select--"
Value="-1"></asp:ListItem>
</asp:DropDownList>
<asp:SqlDataSource
ID="PrescriptionCodeDataSource"
runat="server"
ConnectionString="<%$ ConnectionStrings:SystemConnectionString %>"
SelectCommand="SELECT [PrescriptionCodeID], [CodeDescription] FROM [PrescriptionCode] WHERE (([Archived] = @Archived)
AND ([PrescriptionCodeGroupID] = @PrescriptionCodeGroupID))">
<SelectParameters>
<asp:Parameter
DefaultValue="False"
Name="Archived"
Type="Boolean"
/>
<asp:ControlParameter
ControlID="ddlPrescriptionCodeGroup"
Name="PrescriptionCodeGroupID"
PropertyName="SelectedValue"
Type="Int32"
/>
</SelectParameters>
</asp:SqlDataSource>

When I select from the first dropdown I want to populate the second. However, this is not happening. The postback is happening, but the SelectedIndexChanged handler isn't being called (I have a breakpoint which isn't being hit). The user controls are created dynamically and put into a PlaceHolder which itself is within an AJAX Updatepanel, with ChildrenAsTriggers set to true.

View 12 Replies

Data Controls :: DropDownList SelectedIndexChanged Event Not Working When Placed Inside GridView Footer

Jan 24, 2016

With ref. to this post, [URL]

I have placed a dropdown list in Gridview footer, now i want to access the dropdown selected indeex changed event as below. But i'm not able to access the event.

protected void ddlCatg_SelectedIndexChanged(object sender, EventArgs e)
{
DropDownList ddlCategories = grvExpenses.FooterRow.FindControl("ddlCatg") as DropDownList;
DropDownList ddlExpenseSubCategories = grvExpenses.FooterRow.FindControl("ddlSubCatg") as DropDownList;
ddlExpenseSubCategories.Items.Clear();

[CODE]..

View 1 Replies

Configuration :: User Leave Form Open For More Than 20 30 Min And Then Click A Button On That Form The Browsers Status Line Shows "Error In Page?

Jul 30, 2010

I have a form that works just fine, problem is that if user leave form open for more than 20 30 min and then click a button on that form the browsers status line shows "Error in page", user then must refresh the page in order for the page function.

View 1 Replies

Window.open Javascript Function Is Not Working In Mozilla, But Working In Other Browsers

Mar 18, 2010

Window.open javascript function is not working in Mozilla, but working in other browsers, here is what I have write.

<a href="javascript:window.open('../Terms.aspx','Terms','width=550,height=400')">
click here</a>

Actually what happened in Mozilla is popup is opened but parent window is blank with [object Window]

View 2 Replies

JQuery :: How To Open A Subform Model Form,Sub Window Form Using Jquery That Save The Data Ajex

Sep 15, 2010

how to open a subform model Form,Sub Window form using jquery that save the data ajex

View 4 Replies

AJAX :: RadioButtonList.SelectedIndexChanged Not Raised When The ListItem Has Selected="True" Not Working

Jun 29, 2010

I have two radiobuttons in radiobuttonlist and based on selection, i am enabling and disabling the text box.
First time i used date radiobutton and i took date in corresponding textbox and i saved it into database and then when i came back on same page i saw the date radiobutton is checked has proper value then i clicked on another radiobutton and this time page is postback and clear my all the data which was in my other controls(I have 5-6 text boxed on my page). I dont know why?, It supposed to select my other radiobutton and enable the corresponding text box

[Code]....

if (!Page.IsPostBack)
{
if (gvCredentialTypes.SelectedIndex >= 0)
{
CredentialType credType = CredentialType.FindCredentialType(gvCredentialTypes.SelectedValue.ToString());
if (!String.IsNullOrEmpty(credType.CredentialTypeName)) //If exists, load data
{
String expDays = credType.ExpirationLength.ToString();
DateTime expDate = Convert.ToDateTime(credType.ExpirationDate);
// Assign the value to the controls
LoadExpirationDaysDateValue(expDays, expDate);
}
}
}

private void LoadExpirationDaysDateValue(String expDays, DateTime expDate)
{
// Determines whether value for Days or Date is present
Boolean IsDays = false;
// Check if days value is present
if (String.IsNullOrEmpty(expDays) || expDays.Equals("0"))
{
txtExpirationDays.Text = String.Empty;
}
else
{
txtExpirationDays.Text = expDays;
IsDays = true;
}
if (expDate.ToShortDateString().Equals ("1/1/0001"))
{
txtExpirationDate.Text = String.Empty;
}
else
{
txtExpirationDate.Text = expDate.ToShortDateString();
IsDays = false;
}
// Set the radio button value based on whether Date or Days value is present
if (IsDays)
{
// Get ref to the 1st radio item
ListItem liExpirationInDays = rbExpiration.Items.FindByValue("rbExpirationInDays");
if (liExpirationInDays != null)
{
liExpirationInDays.Selected = true;
rbExpiration.Items.FindByValue("rbExpirationDate").Selected = false;
txtExpirationDate.Text = string.Empty;
txtExpirationDays.Text = expDays;
// Enable or disable the controls based on the radio button selection
txtExpirationDays.Enabled = true;
RequiredFieldValidator1.Enabled = true;
RangeValidator1.Enabled = true;
txtExpirationDate.Enabled = false;
RegularExpressionValidator1.Enabled = false;
CalendarExtender2.Enabled = false;
//compDateValidator.Enabled = false;
RequiredFieldValidator2.Enabled = false;
}
}
else
{
// Get ref to the 2nd radio item
ListItem liExpirationDate = rbExpiration.Items.FindByValue("rbExpirationDate");
if (liExpirationDate != null)
{
liExpirationDate.Selected = true;
rbExpiration.Items.FindByValue("rbExpirationInDays").Selected = false;
txtExpirationDays.Text = string.Empty;
txtExpirationDate.Text = expDate.ToShortDateString();
// Enable or disable the controls based on the radio button selection
txtExpirationDate.Enabled = true;
RegularExpressionValidator1.Enabled = true;
RequiredFieldValidator2.Enabled = true;
CalendarExtender2.Enabled = true;
//compDateValidator.Enabled = true;
txtExpirationDays.Enabled = false;
RequiredFieldValidator1.Enabled = false;
RangeValidator1.Enabled = false;
}
}
}

private void EnableCorrespondingTextbox()
{
switch (rbExpiration.SelectedItem.Value)
{
case "rbExpirationInDays":
txtExpirationDays.Enabled = true;
RequiredFieldValidator1.Enabled = true;
RangeValidator1.Enabled = true;
txtExpirationDate.Text = String.Empty;
txtExpirationDate.Enabled = false;
RegularExpressionValidator1.Enabled = false;
CalendarExtender2.Enabled = false;
RequiredFieldValidator2.Enabled = false;
//compDateValidator.Enabled = false;
break;
case "rbExpirationDate":
txtExpirationDate.Enabled = true;
RegularExpressionValidator1.Enabled = true;
RequiredFieldValidator2.Enabled = true;
CalendarExtender2.Enabled = true;
//compDateValidator.Enabled = true;
txtExpirationDays.Text = String.Empty;
txtExpirationDays.Enabled = false;
RequiredFieldValidator1.Enabled = false;
RangeValidator1.Enabled = false;
break;
}
}

protected void OnSelectedIndexChangedMethod(object sender, EventArgs e)
{
EnableCorrespondingTextbox();
}

View 4 Replies

Web Forms :: Form Inside Form Working?

Mar 19, 2010

there is one dynamic page, that, from a database, based on a lot of gathered information (user id, account #, etc), actually 'spits' out an html form, with an action which goes to a website and sends a bunch of hidden information from our site.y situation is this - I am building a master page for the site, which will include the form tag for the content pagesdon't see how this will work, without rewriting what comes from the database - - -

View 8 Replies

How To Open And Fill In A PDF Form

Dec 23, 2010

I am trying to open a PDF and fill it in in an asp webpage. Does anyone know how to do this? I can either overlay the PDF with labels or I could fill in the PDF form (Obviously that would be better)

View 5 Replies

Open A Form On Fav-icon Click?

Feb 27, 2010

I want to pop up or open new form on the click of fav-icon.....

View 2 Replies

VS 2008 Open The Form A Modal Dialog Box?

May 4, 2010

Code:

[code]....

Secondly,I want to open the form a Modal Dialog Box,Is It Possible?/

View 6 Replies

Button To Open Panel Resets The Form?

Jul 20, 2010

We have an application that runs with IE. Iīm trying to set up a ASP site. The application has some kind of autofunction. If the textboxes is named correctly they will read the data from a SQL server table (eg names, addresses).

I have set up a panel and a button (button2"). When the button is used the panel becomes visible. However this does also resets the form to itīs initial state. Letīs say I have changed the name input and then press the button, itīs reset the form and inputs to itīs earlier value. I donīt want that to happen. Also the button "mail" isnīt visible until I press the button to show the panel, but the button "mail" is not included in the panel.

Why is this happen?

Code:

[Code]....

View 21 Replies

Javascript - C#, Open Web Form When Click On The Datagrid Row?

Sep 17, 2010

Using Datagrid I am trying Web Form on click datagrid row, Any body suggest how I do this.

View 1 Replies

Open Source .Net Web Registration Form Generator?

Nov 30, 2010

Anybody know of / have experience with .net web registration form generator, that is free and/or open source?

Something like a very simple version of InfoPath web forms.

View 1 Replies

Keep Text Flat File Open Between Form Submits?

Mar 28, 2011

I'm using a log file to document info while getting and processing info from a form

1. if not post back, open the log file, build page, send form. 2. get submit back from form, possible post back if errors, possible writes to log file, if no errors definitely writes to log file, and send confirm page. 3. postback from confirm page can either be going back to form or finalizing, and send acknowledge page, then done.

so I need to keep the logfile object between direct postbacks to the form, or posting back to orignal form page after gettting a postback from a confirm page.

this type of file setup works fine, it creates a single log file per day:

[Code]....

then successive writes are like this:

[Code]....

when the form submit comes back from the original send/submit, lf from above is 'nothing'

saw the post about 9 ways to maintain state, not sure at all which would be most appropriate to keep the lf object accessible between possible postbacks and submits to the form.

View 4 Replies

JQuery :: Model Form Open But Page Content Is Not Show?

Nov 20, 2010

i am loading a page when we click a button .i am require a loadimage.show when i div laoding time and disapper when i div loaded but model form content is not show

[Code]....

View 3 Replies







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