MGBrown.com

Auto-Postback Dropdown lists

I use a mouse with a scroll wheel between the two buttons. I often find that I click on a dropdown list and then try to use the wheel to move the page up a bit. As I have just clicked on the dropdown, what actually happens is that the selected item changes instead.

Normally this is not too much of an issue, I just go and reselect the option I wanted and continue. It does become a problem, however, when a web developer has used the OnChange event to go back to the server and reconfigure the form. This is normally a slow process and stops my train of thought long enough to really bug me.

So please I ask everyone that needs to reconfigure based on a dropdown selection to please put a little 'Go' button next to it instead.

Comments

Re: Auto-Postback Dropdown lists

this is the code behind

Private Sub PSG_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PSG.CheckedChanged

Dim dcmdb As New ASPNetPortal.CustConfig()
Dim dn As New DataSet()

If AMK.Checked Then

dn = dcmdb.GetProdCode_PSG_AMK()

ElseIf WUXI.Checked Then

dn = dcmdb.GetProdCode_PSG_WUXI()

End If

ProdCode.DataSource = dn
ProdCode.DataTextField = "PRODUCT"
ProdCode.DataBind()

End Sub

Private Sub ESG_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ESG.CheckedChanged

Dim dcmdb As New ASPNetPortal.CustConfig()
Dim dn As New DataSet()

If AMK.Checked Then

dn = dcmdb.GetProdCode_ESG_AMK()

ElseIf WUXI.Checked Then

dn = dcmdb.GetProdCode_ESG_WUXI()

End If

ProdCode.DataSource = dn
ProdCode.DataTextField = "PRODUCT"
ProdCode.DataBind()

End Sub

Private Sub ProdCode_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ProdCode.SelectedIndexChanged

Dim dcmdb As New ASPNetPortal.CustConfig()
Dim dn As New DataSet()

If AMK.Checked Then

If PSG.Checked Then

dn = dcmdb.GetPartNum_PSG_AMK(ProdCode.SelectedItem.Value)

PartNum.DataSource = dn
PartNum.DataTextField = "PART_NUM"
PartNum.DataBind()

ElseIf ESG.Checked Then

dn = dcmdb.GetPartNum_ESG_AMK(ProdCode.SelectedItem.Value)

PartNum.DataSource = dn
PartNum.DataTextField = "MEPNUM"
PartNum.DataBind()
End If

ElseIf WUXI.Checked Then

If PSG.Checked Then

dn = dcmdb.GetPartNum_PSG_WUXI(ProdCode.SelectedItem.Value)

PartNum.DataSource = dn
PartNum.DataTextField = "PART_NUM"
PartNum.DataBind()

ElseIf ESG.Checked Then

dn = dcmdb.GetPartNum_ESG_WUXI(ProdCode.SelectedItem.Value)

PartNum.DataSource = dn
PartNum.DataTextField = "MEPNUM"
PartNum.DataBind()
End If

End If

This is the vb code which contain those sql query

Public Function GetProdCode_PSG_AMK()

Dim myconnect1 As New OracleConnection()

myconnect1.ConnectionString = ConfigurationSettings.AppSettings("DCMConnectionString")
myconnect1.Open()

Dim mycommand As New OracleDataAdapter("select PRODUCT from PRODUCT_MATRIX where PRODUCT_TYPE = 'PSG' order by PRODUCT", myconnect1)
mycommand.SelectCommand.CommandType = CommandType.Text

Dim mydataset As New DataSet()
mycommand.Fill(mydataset)

Return mydataset

myconnect1.Close()

End Function

Public Function GetPartNum_PSG_AMK(ByVal prodcode As String) As DataSet

Dim myconnect1 As New OracleConnection()

myconnect1.ConnectionString = ConfigurationSettings.AppSettings("DCMConnectionString")
myconnect1.Open()

Dim mycommand As New OracleDataAdapter("select distinct PART_NUM from DCC_MASTER where PART_NUM like '" & prodcode & "%' order by PART_NUM", myconnect1)
mycommand.SelectCommand.CommandType = CommandType.Text

Dim mydataset As New DataSet()
mycommand.Fill(mydataset)

Return mydataset

myconnect1.Close()

End Function

Comment from Kursat Unlukara at Tuesday, 27 September 2005 01:40PM (GMT+00)

Re: Auto-Postback Dropdown lists

Thanks for the tip! I think your right. it always bugs the hek out of me! when your focused your focused! lets just keep that train rolling!
I will pass this info along to help others!

Comment from james kingsted at Friday, 06 April 2007 11:12AM (GMT+00)

Sorry, this post is no longer accepting comments.