none
Devexpress RowUpdating ve RowValidating RRS feed

  • Genel Tartışma

  • Merhaba;

    Rowupdating ve rowvalidating eventlerini birlikte aşağıdaki gibi kullanma istiyorum fakat aşağıdaki haliyle textbox boş ve dolu olarak kaydedemiyorum.Yalnızca textbox için;

    if(!gorkisi.isvalid) 

                    

    { errLab.Visible = true;

                    errLab.Text = "Please correct this value";
                  }
    else {updat command....

    }

    olacak şekilde kodu güncellediğimde Belirtilen Yöntem Desteklenmiyor hatası alıyorum.

    Konu ile ilgili yardımcı olur musunuz?Teşekkürler

     protected void ASPxGridView1_RowValidating(object sender, DevExpress.Web.Data.ASPxDataValidationEventArgs e)
            {
                
              if (e.NewValues["GORUSME_YAPILAN_KISI"].ToString() == "" )
                    {
                        e.Errors.Add(((ASPxGridView)sender).Columns["GORUSME_YAPILAN_KISI"], "Incorrect value");
                        ASPxTextBox gorkisi = ((ASPxGridView)sender).FindEditFormTemplateControl("gorkisi") as ASPxTextBox;
                        gorkisi.IsValid = false;
                      e.RowError = "fsdfsd";
                       
                    }      
            }     
      protected void grid_RowUpdating(object sender, ASPxDataUpdatingEventArgs e)
            {
             ybs.Open();
        
                    int i = ASPxGridView1.FindVisibleIndexByKeyValue(e.Keys[ASPxGridView1.KeyFieldName]);
                    int LOGICALREF = Convert.ToInt32(ASPxGridView1.GetRowValues(i, ASPxGridView1.KeyFieldName));
                   
                    ASPxTextBox gorkisi = ((ASPxGridView)sender).FindEditFormTemplateControl("gorkisi") as ASPxTextBox;
                    string GORUSME_YAPILAN_KISI = gorkisi.Text;
                    ASPxLabel errLab = ((ASPxGridView)sender).FindEditFormTemplateControl("errLab") as ASPxLabel;
    
                    ASPxGridView1.DoRowValidation();
              if(!page.isvalid)
         { errLab.Visible = true;
                    
                    errLab.Text = "Please correct this value";
                  }
    else
    {  SqlCommand kom2 = new SqlCommand("update CRM_MUSTERI_ZIYARETLERI SET [GORUSME_NOTLARI]=@GOR," +
                        "GORUSME_YAPILAN_KISI=@GORUSME_YAPILAN_KISI,MAIL_ADRESI=@MAIL_ADRESI," +
                        "BIRAKILAN_NUMUNE=@BIRAKILAN_NUMUNE,SONUC=@SONUC,DURUM=@DURUM, " +
                        "GORUSME_TARIHI=@GORUSME_TARIHI " +
                        "WHERE LOGICALREF=@LOGICALREF", ybs);
                    kom2.Parameters.AddWithValue("@LOGICALREF", System.Data.SqlDbType.Int);
                    kom2.Parameters["@LOGICALREF"].Value = LOGICALREF;
                    kom2.Parameters.Add("@GORUSME_YAPILAN_KISI", System.Data.SqlDbType.VarChar, 50);
                    kom2.Parameters["@GORUSME_YAPILAN_KISI"].Value = GORUSME_YAPILAN_KISI;
    .............
       kom2.ExecuteNonQuery();
                    ybs.Close();
                    dataaktar();
    
                    e.Cancel = true;
    
                    ASPxGridView1.CancelEdit();
                
              
                }
            }
    
    
    ​


    <dx:ASPxGridView ID="ASPxGridView1" runat="server" CssClass="grid" ClientInstanceName="grid" KeyFieldName="LOGICALREF" AutoGenerateColumns="False" OnRowUpdating="grid_RowUpdating" >
                    <SettingsPager PageSize="30">
                    </SettingsPager>
                    <Settings ShowFilterRowMenu="true"  ShowFilterRow="true" ShowFilterBar="Visible" ShowFilterRowMenuLikeItem="true" />
                    <Columns>
                        <dx:GridViewCommandColumn ShowSelectCheckbox="True" SelectAllCheckboxMode="Page" Visible="false" VisibleIndex="9" />
                        <dx:GridViewCommandColumn ShowEditButton="True" VisibleIndex="0">
                        </dx:GridViewCommandColumn>
                        <dx:GridViewDataTextColumn FieldName="DEFINITION_" Caption="MÜŞTERİ ADI" VisibleIndex="2"></dx:GridViewDataTextColumn>
    ..................
                                            </dx:GridViewDataDateColumn>
                        <dx:GridViewDataTextColumn FieldName="GORUSME_YAPILAN_KISI" Caption="GÖRÜŞME YAPILAN KİŞİ" Visible="false" VisibleIndex="4"></dx:GridViewDataTextColumn>
                   
                    </Columns>
                                   <Templates>
                        <EditForm>
    
                            <table align="center">
    
                                <tr>
                                    <td class="tdaciklama">
                                        <asp:Label ID="Label3" runat="server" Text="CARİ HESAP ADI"></asp:Label>
                                    </td>
                                    <td>
                                        <dx:ASPxLabel ID="me" runat="server" CssClass="txt" Text='<%# Bind("DEFINITION_") %>' />
                                    </td>
                                </tr>
                                  <tr>
                                    <td class="tdaciklama">
                                        <asp:Label ID="Label2" runat="server" Text="GÖRÜŞME YAPILAN KİŞİ"></asp:Label>
                                    </td>
                                    <td>
                                        <dx:ASPxTextBox ID="gorkisi" runat="server" CssClass="txt" Text='<%#DataBinder.Eval(Container.DataItem, "GORUSME_YAPILAN_KISI")%>'     
     ValidationSettings-ValidationGroup="a">
                                                            <validationsettings CausesValidation="true"  ValidationGroup="a">
                                                                <requiredfield IsRequired="true" ErrorText="Customer Name" /> 
                                                            </validationsettings> </dx:ASPxTextBox>
                                                                       </td> </tr> </table>
                        </EditForm>
                    </Templates>
                    <SettingsPopup> 
                <EditForm Width="600"  Height="400" VerticalAlign="Middle" HorizontalAlign="Center"/>
            </SettingsPopup>
                </dx:ASPxGridView>
    


    11 Ocak 2017 Çarşamba 10:00