Hi Frnds,
Today i m trying to share with you one interesting things... like how can we find "who is responsible for postback ?"
very easily w to catch target controls who fired postback event.
Take a look of this code.
Protected Overrides Sub OnLoad(ByVal e As System.EventArgs)
MyBase.OnLoad(e)
If Page.Request.Params("__EVENTTARGET") = btnClikOk.UniqueID Then
txtResult.Text = "Ok Button has clicked"
End If
If Page.Request.Params("__EVENTTARGET") = Button1.UniqueID Then
txtResult.Text = "Cancel button has clicked"
End If
End Sub
Page.Request.Params("__EVENTTARGET") this one will return target control ID and by condition checking you can catch Control.
Don't you think this is very simple ?
Today i m trying to share with you one interesting things... like how can we find "who is responsible for postback ?"
very easily w to catch target controls who fired postback event.
Take a look of this code.
Protected Overrides Sub OnLoad(ByVal e As System.EventArgs)
MyBase.OnLoad(e)
If Page.Request.Params("__EVENTTARGET") = btnClikOk.UniqueID Then
txtResult.Text = "Ok Button has clicked"
End If
If Page.Request.Params("__EVENTTARGET") = Button1.UniqueID Then
txtResult.Text = "Cancel button has clicked"
End If
End Sub
Page.Request.Params("__EVENTTARGET") this one will return target control ID and by condition checking you can catch Control.
Don't you think this is very simple ?
No comments:
Post a Comment