Rank: Newbie Groups: Member
Joined: 11/30/2007 Posts: 1
|
I used MaskedEdit into datagrid, I bind dynamics segment for each MaskedEdit And function correctly, When I try to get (Sub ImageButton1_Click) input data typed from user in datagrid MaskedEdit.text the value is empty, in the other thinks when a bind from Visual Studio the static segment (comment segment from item databound) return the input data typed for user correctly.
Not function MaskedEdit.text
• Protected Sub dgIncrease_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles dgIncrease.ItemDataBound • • If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Then • • Dim obj As EO.Web.MaskedEdit = CType(e.Item.FindControl("MaskedEdit1"), EO.Web.MaskedEdit) • Dim strSql As String = "select euid, IncreaseBreederDecision from informes where euid='" & e.Item.Cells(2).Text & "' and temporada='" & strTemporada_ & "' and informe='" & strInforme_ & "'" • Dim ds As DataSet = SqlHelper.ExecuteDataset(strConn, CommandType.Text, strSql) • • Dim strSql_ As String = "select dhcl1n,pedigree from _" & strTemporada_ & " where euid='" & ds.Tables(0).Rows.Item(0).Item("euid").ToString & "' " • Dim ds_ As DataSet = SqlHelper.ExecuteDataset(strConn, CommandType.Text, strSql_) • • Dim objEditSegment As New EO.Web.MaskedEditSegment • objEditSegment.MaxValue = traeTotalEstimado(ds_.Tables(0).Rows.Item(0).Item("dhcl1n").ToString, ds_.Tables(0).Rows.Item(0).Item("pedigree").ToString) • objEditSegment.MinValue = 0 • objEditSegment.SegmentType = EO.Web.MaskedEditSegmentType.Number • objEditSegment.Text = ds.Tables(0).Rows.Item(0).Item("IncreaseBreederDecision").ToString • • obj.Segments.Add(objEditSegment) • • End If • End Sub
• Protected Sub ImageButton1_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles imgBtnGrabar.Click • • Dim dg2 As DataGrid = dgIncrease • Dim x0 As Integer • For x0 = 0 To dg2.Items.Count - 1 • If dg2.Items.Item(x0).ItemIndex <> -1 Then • • Dim obj As EO.Web.MaskedEdit = dg2.Items(x0).FindControl("MaskedEdit1") ‘this object always is empty. • • End If • Next • End Sub
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,193
|
Hi,
Your code looks fine to us. So the problem might be somewhere else. You can try to create a blank page and then try the same feature there first. Try the following steps:
1. Create a blank form with a single DataGrid control; 2. Add a TemplateColumn to the Grid; 3. Add a MaskedEdit control to the TemplateColumn's ItemTemplate. Configure the MaskedEdit correctly so that it has at least one segment; 4. Populate the Grid in Page_Load; 5. Place a Button in the form and check the MaskedEdit control in the button's Click handler;
That should work fine without any problem. You can then compare your page with this page. That should help you find out the root of the problem.
Thanks
|