Hi,
There is no property of autopostback for the document ... and for the text
boxes and the button the autopostback is false.... My problem -
I have 2 pages- on one page there r 2 text boxes, one command button and a
datagrid... i'm populating this grid by entring some crieria. in the text
box..
Now u know that u can put select col. for row selection in datagrid.. i
have done the same... now when u select one row from the datagrid the
itemcommand event is fired... and i trap this and using the "e" arg..
which as an item.cells collection and i redirect to a different page.. the
code is as.
Protected Sub DataGrid1_ItemCommand(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataGridCommandEventArgs) Handles
DataGrid1.ItemCommand
DataGrid1.SelectedIndex = E.Item.ItemIndex
Dim PDesc As String
Dim PCode As String
Ccode = Request.QueryString.Item(1)
PDesc = E.Item.Cells(3).Text
PCode = E.Item.Cells(4).Text
If E.Item.ItemIndex >= 0 Then
Response.Redirect("CompanyProblemList.aspx?CustCode=" + Ccode + "&
ProdDesc = " + PDesc + "& ProdCode =" + PCode + "& CName =" +
Request.QueryString.Item(0) + "")
End If
End Sub
I hope u got this code..
THE PROBLEM when u press the back button of the browser and put some
values in the textbox and try to populate the DG why the above event is
fired.. & when u refresh the browser... it works...
The code for the button click and datagrid population....
Public Sub btInvoiceDetails_Click(ByVal sender As Object, ByVal e
As System.EventArgs)
If (Page.IsValid = True) Then
BindData()
End If
End Sub
Public Sub BindData()
If IsPostBack Then
Dim code As String
code = Request.QueryString.Item(1)
Dim Command As ADODataSetCommand
Dim ds As New DataSet()
Dim Sql As String
Dim myConnection As New ADOConnection
(cRMProComponents.cRMProComponents.cRMPro.ConnectString)
'Dim Command As ADODataSetCommand
'Dim ds As New DataSet()
If (txtInvoiceNo.Text = "" And txtInvoiceDate.Text = "")
Then
Sql = "select i.InvoiceCode, Convert
(nvarchar,i.InvoiceDate,103) As InvoiceDate , p.Description ,i.ProductCode
from invoice i, product p where i.Custcode = '" & code & "' and
i.productcode = p.productcode"
Else
Sql = "select i.InvoiceCode, Convert
(nvarchar,i.InvoiceDate,103) as InvoiceDate , p.Description ,i.ProductCode
from invoice i, product p where i.productcode = p.productcode and
i.Custcode = '" & code & "'and i.InvoiceCode = '" & txtInvoiceNo.Text & "'
and i.invoiceDate = Convert(datetime,'" & txtInvoiceDate.Text & "',103)"
End If
Command = New ADODataSetCommand(Sql, myconnection)
Command.FillDataSet(ds, "MyView")
DataGrid1.DataSource = ds.Tables("Myview").DefaultView
DataGrid1.DataBind()
ds = Nothing
command = Nothing
myConnection = Nothing
End If
End Sub
Pl. help...
--------------------------------------------------------------------------
> hi
>
> are u tried autopostback in the page or else pls gimme more details
abiut ur
> problem
>
> thanx
>
> >From: "mukesh parekh" <parekhmukesh@y...>
> >Reply-To: "ASPX_Professional" <aspx_professional@p...>
> >To: "ASPX_Professional" <aspx_professional@p...>
> >Subject: [aspx_professional] Datagrid Event Behaviour
> >Date: Tue, 24 Apr 2001 07:28:27
> >
> >Hi,
> >
> >I'm developing one web app. in asp.net with vb. I have one problem in
the
> >behaviour of datagrids events.. In one page i have 2 text box and
button,
> >now depending upon the values in the TB a datagrid below is populated..
> >Now whenever a user selects an item from a datagrid i'm navigating
> >(redirecting) to a different page.. here the Datagrid_Indexcommand event
> >proc. is used... now when the user clicks the BACK Button of the browser
> >and reenters different values in TB to re-poupulate the Datagrid.. why
> >the Datagrid_Indexcommand event is executed.. and page is navigated..
> >
> >Please Help
> >Thanks & Regards..