473,395 Members | 1,677 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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.WebControls.DropDownList
---

If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType =
ListItemType.AlternatingItem Then ' pls don't add foooter

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

bgt = e.Item.FindControl("accountid")
bgt.ID = e.Item.ItemIndex
bgt.DataMember = "GeneralLedger"
bgt.DataValueField = "AccountID"
bgt.DataSource = ds.Tables(0).DefaultView
bgt.DataTextField = "GLAccountName"
bgt.AutoPostBack = True
bgt.EnableViewState = True
bgt.DataBind()

AddHandler bgt.SelectedIndexChanged, AddressOf
onSelectedIndexChangedevent
end if

end sub
---

and i have this code

Private Sub bgt_SelectedIndexChanged(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles bgt.SelectedIndexChanged
Response.Write("<script>alert('Evnet chanrged!!!')</script>")
Response.Write(bgt.SelectedValue())
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 1827
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.WebControls.DropDownList
---

If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType =
ListItemType.AlternatingItem Then ' pls don't add foooter

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

bgt = e.Item.FindControl("accountid")
bgt.ID = e.Item.ItemIndex
bgt.DataMember = "GeneralLedger"
bgt.DataValueField = "AccountID"
bgt.DataSource = ds.Tables(0).DefaultView
bgt.DataTextField = "GLAccountName"
bgt.AutoPostBack = True
bgt.EnableViewState = True
bgt.DataBind()

AddHandler bgt.SelectedIndexChanged, AddressOf
onSelectedIndexChangedevent
end if

end sub
---

and i have this code

Private Sub bgt_SelectedIndexChanged(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles bgt.SelectedIndexChanged
Response.Write("<script>alert('Evnet chanrged!!!')</script>")
Response.Write(bgt.SelectedValue())
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.WebControls.DropDownList
---

If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType =
ListItemType.AlternatingItem Then ' pls don't add foooter

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

bgt = e.Item.FindControl("accountid")
bgt.ID = e.Item.ItemIndex
bgt.DataMember = "GeneralLedger"
bgt.DataValueField = "AccountID"
bgt.DataSource = ds.Tables(0).DefaultView
bgt.DataTextField = "GLAccountName"
bgt.AutoPostBack = True
bgt.EnableViewState = True
bgt.DataBind()

AddHandler bgt.SelectedIndexChanged, AddressOf
onSelectedIndexChangedevent
end if

end sub
---

and i have this code

Private Sub bgt_SelectedIndexChanged(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles bgt.SelectedIndexChanged
Response.Write("<script>alert('Evnet chanrged!!!')</script>")
Response.Write(bgt.SelectedValue())
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
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...
1
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...
1
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...
5
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...
5
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...
6
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...
0
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...
1
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...
0
by: MaryamSh | last post by:
Create Dynamic Dropdownlist Controls and related event -------------------------------------------------------------------------------- Hi, I am creating a Dynamic Search in my application. I...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.