My code in program.ascx is
My javascript function is
My code in the Program.ascx.cs
protected void dd_SelectedIndexChanged(object sender, EventArgs e)
{
int DiagResult = int.Parse(inpHide.Value);
if (DiagResult == 1)
{
//Do Somthing
Response.Write("You Have Selected Ok");
}
else if (DiagResult == 0)
{
//Do somthing
Response.Write("You have Selected Cancel");
}
}
In short whenever the dropdown list value changes,It should notify change to user.
I got the same code from this forum but they did it in page i.e. aspx and aspx.cs.,Dat is working fine ...But when i am implementing in usercontrol like above (and integrating the code in my project) ..Its giving error as impHide is unknown in the following context.means the value is not retrieved from the Program.ascx file.I am unable to find the main cause.
Pls help me to solve this
Thanks...
KritiPosted Dec 31, 2009, 3:15 AM
As told by you..i hav done the modifications..but again same error..hence i m pasting my whole code..though i have deleted many things which are not necessary to b shown here..U just go throgh the code and tell me the scenario as to y its not able to retrieve the impHide value
<%@ Control Language="c#" AutoEventWireup="false" Codebehind="Program.ascx.cs" Inherits="a.b.c.Program" TargetSchema="http://schemas.microsoft.com/intellisense/ie5"%>
<%@ Import namespace="System.Text" %>
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
http://www.w3.org/1999/xhtml">
My Program.ascx.cs is
namespace a.b.c
{
using System;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Text;
using System.Drawing;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Collections.Generic;
using System.Web;
///
///
///
public partial class Program : System.Web.UI.UserControl
{
private string tDate = string.Empty;
#region Class Variables
//strings and variables initialization
#region GUI Components
//all gui componenets..
protected System.Web.UI.WebControls.Label Label1;
protected System.Web.UI.WebControls.ImageButton btnRefresh;
#endregion
#endregion
#region Public Properties
public bool IsAdmin
{
}
public string SortExpression
{
}
//many public functions
#endregion
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
InitializeComponent();
base.OnInit(e);
}
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
this.btnSaveChanges.Click += new System.Web.UI.ImageClickEventHandler(this.btnSaveChanges_Click);
this.btnExcel.Click += new System.Web.UI.ImageClickEventHandler(this.btnExcel_Click);
//many more
this.Load += new System.EventHandler(this.Page_Load);
// this.ddPreApproved.SelectedIndexChanged += new System.EventHandler(this.ddPreApproved_SelectedIndexChanged);
}
#endregion
#region Public Methods
//many more public method..
public void Refresh()
{
try
{
}
catch (Exception ex)
{
}
}
#endregion
#region Private Methods
//many private functions...i have just displayed mine..I have changed private to //protected..then also not working
private void ddPreApproved_SelectedIndexChanged(object sender, EventArgs e)
{
int DiagResult = int.Parse(inpHide.Value);
if (DiagResult == 1)
{
//Do Somthing
Response.Write("You Have Selected Ok");
}
else if (DiagResult == 0)
{
//Do somthing
Response.Write("You have Selected Cancel");
}
}
private void btnSaveChanges_Click(object sender, System.Web.UI.ImageClickEventArgs e)
{
}
#endregion
}
}
I hve tried more than 20 different scenario..but all a dud!! ..do u think of any soln for this so that impHide is retrieved..Do u think there is problen in the Program.ascx..Just check it if i have put form and div correctly...
Kirtan PatelPosted Dec 31, 2009, 12:18 AM
Here i Coded It For UserControl .
Check the Attachment .
and do check "Do you like this answer" check box please it will give me some credits :) hope you understand it :)