473,666 Members | 2,386 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

dynamic events for dropdownlist not working in datagrid

rt
hi,
iam a having a datagrid,
pls check the code


----
Public WithEvents bgt As System.Web.UI.W ebControls.Drop DownList
---

If e.Item.ItemType = ListItemType.It em Or e.Item.ItemType =
ListItemType.Al ternatingItem Then ' pls don't add foooter

SqlDataAdapter2 .SelectCommand. CommandText = "select * from Generalledger
where active=1 and Glaccounttype=' " & GLTransactionTy pe.SelectedValu e & "'
order by glaccountno "
Dim ds As New DataSet
SqlDataAdapter2 .Fill(ds, "Generalledger" )

bgt = e.Item.FindCont rol("accountid" )
bgt.ID = e.Item.ItemInde x
bgt.DataMember = "GeneralLed ger"
bgt.DataValueFi eld = "AccountID"
bgt.DataSource = ds.Tables(0).De faultView
bgt.DataTextFie ld = "GLAccountN ame"
bgt.AutoPostBac k = True
bgt.EnableViewS tate = True
bgt.DataBind()

AddHandler bgt.SelectedInd exChanged, AddressOf
onSelectedIndex Changedevent
end if

end sub
---

and i have this code

Private Sub bgt_SelectedInd exChanged(ByVal sender As System.Object, ByVal e
As System.EventArg s) Handles bgt.SelectedInd exChanged
Response.Write( "<script>alert( 'Evnet chanrged!!!')</script>")
Response.Write( bgt.SelectedVal ue())
End Sub

-------

the above bgt event is not working, how should i change, or how i modify...
pls help me

thanks

Nov 19 '05 #1
2 1841
Have you set the AutoPostBack property of the DDL to True? If not set it and
it should fix your problem.

HTH

Pete

"rt" wrote:
hi,
iam a having a datagrid,
pls check the code


----
Public WithEvents bgt As System.Web.UI.W ebControls.Drop DownList
---

If e.Item.ItemType = ListItemType.It em Or e.Item.ItemType =
ListItemType.Al ternatingItem Then ' pls don't add foooter

SqlDataAdapter2 .SelectCommand. CommandText = "select * from Generalledger
where active=1 and Glaccounttype=' " & GLTransactionTy pe.SelectedValu e & "'
order by glaccountno "
Dim ds As New DataSet
SqlDataAdapter2 .Fill(ds, "Generalledger" )

bgt = e.Item.FindCont rol("accountid" )
bgt.ID = e.Item.ItemInde x
bgt.DataMember = "GeneralLed ger"
bgt.DataValueFi eld = "AccountID"
bgt.DataSource = ds.Tables(0).De faultView
bgt.DataTextFie ld = "GLAccountN ame"
bgt.AutoPostBac k = True
bgt.EnableViewS tate = True
bgt.DataBind()

AddHandler bgt.SelectedInd exChanged, AddressOf
onSelectedIndex Changedevent
end if

end sub
---

and i have this code

Private Sub bgt_SelectedInd exChanged(ByVal sender As System.Object, ByVal e
As System.EventArg s) Handles bgt.SelectedInd exChanged
Response.Write( "<script>alert( 'Evnet chanrged!!!')</script>")
Response.Write( bgt.SelectedVal ue())
End Sub

-------

the above bgt event is not working, how should i change, or how i modify...
pls help me

thanks

Nov 19 '05 #2
rt
hi pete,
in the code it self i put dropdownlist autopostback is true.
but it is not working, i think this not the solution

thanks
"Pete" wrote:
Have you set the AutoPostBack property of the DDL to True? If not set it and
it should fix your problem.

HTH

Pete

"rt" wrote:
hi,
iam a having a datagrid,
pls check the code


----
Public WithEvents bgt As System.Web.UI.W ebControls.Drop DownList
---

If e.Item.ItemType = ListItemType.It em Or e.Item.ItemType =
ListItemType.Al ternatingItem Then ' pls don't add foooter

SqlDataAdapter2 .SelectCommand. CommandText = "select * from Generalledger
where active=1 and Glaccounttype=' " & GLTransactionTy pe.SelectedValu e & "'
order by glaccountno "
Dim ds As New DataSet
SqlDataAdapter2 .Fill(ds, "Generalledger" )

bgt = e.Item.FindCont rol("accountid" )
bgt.ID = e.Item.ItemInde x
bgt.DataMember = "GeneralLed ger"
bgt.DataValueFi eld = "AccountID"
bgt.DataSource = ds.Tables(0).De faultView
bgt.DataTextFie ld = "GLAccountN ame"
bgt.AutoPostBac k = True
bgt.EnableViewS tate = True
bgt.DataBind()

AddHandler bgt.SelectedInd exChanged, AddressOf
onSelectedIndex Changedevent
end if

end sub
---

and i have this code

Private Sub bgt_SelectedInd exChanged(ByVal sender As System.Object, ByVal e
As System.EventArg s) Handles bgt.SelectedInd exChanged
Response.Write( "<script>alert( 'Evnet chanrged!!!')</script>")
Response.Write( bgt.SelectedVal ue())
End Sub

-------

the above bgt event is not working, how should i change, or how i modify...
pls help me

thanks

Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
4474
by: Mark | last post by:
I have been working for quite some time on this issue which in theory should be quite simple. The problem is that the Cancel and Save events are not fired when their respective buttons are clicked. I have read several posts which say to put your column generating section in the Page_Init section and it will solve the problem....however, it hasn't solved mine. Can somebody please take a look at this and provide any insight if possible?
1
7565
by: Shourie | last post by:
I've noticed that none of the child controls events are firing for the first time from the dynamic user control. Here is the event cycle. 1) MainPage_load 2) User control1_Load user clicks a dropdown in UC1 _________________________ 1) MainPage_Load 2) User Control_1 Load
1
4314
by: Rick | last post by:
Hello all, I hope all is well with you. I am having a seriously difficult time with this problem. Allow me to set up the problem. I have a System.Web.UI.Page with the following controls (watch the layout, some have child controls):
5
2415
by: mytestemailaccount | last post by:
Hi, Hope you can help. I am relatively new to all this but would appreciate the groups help. The scenario: I am c# and asp.net to create a web application. The web page contains a user control (.ascx).
5
3390
by: js | last post by:
I am having a problem with a dynamicly added DataGrid that always shows the first data page even the message in the DataGrid.PreRender shows the correct datapage as the DropDownList control's SelectedIndex. The DataGrid CurrentPageIndex is controlled by a DropDownList control. Anyone knows what might be going wrong? Thanks. The addDataGrid() is fired by the following 3 events: private void btnLookup_Click(object sender,...
6
1742
by: Steve Hershoff | last post by:
Hi everyone, I've got a strange one here. There are two datagrids on my page, one nested within the other. I'll refer to them as the topmost and secondary datagrids. In the topmost datagrid's OnItemDataBound() method we check for the row in which it's appropriate to add the secondary datagrid. Exactly one row in the topmost grid will contain the secondary grid.
0
2906
by: cindy | last post by:
I have a dynamic datagrid. I have custom classes for the controls public class CreateEditItemTemplateDDL : ITemplate { DataTable dtBind; string strddlName; string strSelectedID; string strDataValueField; string strDataTextField; public CreateEditItemTemplateDDL(string DDLName,string DataValueField,string
1
4652
by: MaryamSh | last post by:
Hi, I am creating a Dynamic Search in my application. I create a user control and in Page_load event I create a dynamic dropdownlist and 2 dynamic button (Add,Remove) By pressing Add button ,another row will be created with the same control (I mean another dropdown and 2 button) and so on. and by pressing Remove button the selecetd row will be removed. I used viewstate to keep my value for postback, I want by changing selectedvalue of...
0
3493
by: MaryamSh | last post by:
Create Dynamic Dropdownlist Controls and related event -------------------------------------------------------------------------------- Hi, I am creating a Dynamic Search in my application. I create a user control and in Page_load event I create a dynamic dropdownlist and 2 dynamic button (Add,Remove) By pressing Add button ,another row will be created with the same control (I mean another dropdown and 2 button) and so on. and by...
0
8440
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8355
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8550
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7381
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6191
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5662
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4365
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2006
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1769
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.