vijaya bharathi

vijaya bharathi

  • NA
  • 3
  • 30.3k

Gridview Row Databound Event

Sep 1 2009 12:37 AM
hello everyone,

i have three dropdowns.based on the dropdown selection grid was loaded.after the gridview load i edit a cell value then automatically aother cell values are changed

first select three dropdowns and click on the button.then the grid was loaded.i have rowdatabound event.at the first time of gridloaded rowdatabound event was fired.


after then i want to change the cell value. i write a javascript

function for calculating the formula.
and my rowdatabound event code is here

If e.Row.RowType = DataControlRowType.DataRow Then

Dim txt2 As TextBox = DirectCast(e.Row.FindControl("textbox2"), TextBox)
Dim txt3 As TextBox = DirectCast(e.Row.FindControl("textbox3"), TextBox)
Dim lbl1 As Label = DirectCast(e.Row.FindControl("label1"), Label)
If e.Row.RowState = DataControlRowState.Edit Then
lbl1.Text = DGV1.Rows(DGV1.SelectedIndex).Cells(3).Text
txt2.Text = DGV1.Rows(DGV1.SelectedIndex).Cells(4).Text
txt3.Text = DGV1.Rows(DGV1.SelectedIndex).Cells(5).Text
End If
Session("txt2") = txt2.Text
Session("txt3") = txt3.Text
Session("lbl1") = lbl1.Text
txt2.Attributes.Add("onblur", "GetDAmt('" & lbl1.Text & "','" & txt2.Text & "','" & txt3.Text & "');")
End If



javascript function

function GetDAmt(mAmt,mPAmt,mDAmt)
{
var mmAmt=0;
var mmPAmt=0;
var mmDAmt=2;

var mmAmt = "<% = Session("lbl1") %>";
alert(mmAmt);

var mmPAmt = "<% = Session("txt2") %>";
alert(mmPAmt);

var mmDAmt = "<% = Session("txt3") %>";
alert(mmDAmt);

mmAmt=document.getElementById(mAmt).value;
mmPAmt=document.getElementById(mPAmt).value;
if (!isNaN(mmAmt))
{
mmDAmt=mmAmt-mmPAmt;
}
document.getElementById(mDAmt).value=mmDAmt;


}


but after the cellv alue changed rowdata bound event was not fired.so the values are all '0's and it gives the value as 0.

what is the problem here.any one help me with this

one thing iam working with asp.net and gridview.

pls not give the examples of windows application and datagrid



Answers (2)