Tabs are not added to tabPanel

Page 2 of 3 FirstFirst 123 LastLast
  1. #11
    hi

    Now it works...
    Thanks Hardik
  2. #12
    Hi

    your most welcome
    Anytime
  3. #13
    Hi Hardik

    Can you help me for this problem

    http://forums.ext.net/showthread.php...gridpanel-data
    protected void SaveUserService(object sender, DirectEventArgs e)
            {
             
                string jsonValues = e.ExtraParams["values"];
                List<Dictionary<string, string>> records = JSON.Deserialize<List<Dictionary<string, string>>>(jsonValues);
                string result = "";
                foreach (var record in records)
                {
                    //result += record["ServiceId"] + " ";
                    //result += record["ServiceName"] + " ";
                    //result += record["Description"] + "<br />";
                    objStaff.FK_ServiceId = Convert.ToDecimal( record["ServiceId"]);
                    objStaff.FK_StaffId=Convert.ToDecimal(cmbUser.Value);
                    X.Msg.Alert("Server", objStaff.FK_StaffId).Show();
                }
               
            }
      <ext:Button ID="btnSaveService" runat="server" Text="Save" Icon="Disk">
                                          <DirectEvents>
                                            <Click OnEvent="SaveUserService">
                                                <ExtraParams>
                                                    <ext:Parameter
                                                        Name="values"
                                                        Value="GridPanel3.getRowsValues()"
                                                        Mode="Raw"
                                                        Encode="true" />
                                                </ExtraParams>
                                            </Click>
                                        </DirectEvents>
                                          
                                        </ext:Button>
    I have tried this code but what happen that when I click on save button only one record is saved to the database...
  4. #14
    Hi vaishali

    Yeah sure ill help you..wait m working on with it
  5. #15
    Hi vaishali

    I worked on your code
    Every thing is perfect except the extra param passed will be

    <ext:Button ID="btnSaveService" runat="server" Text="Save" Icon="Disk">
    <DirectEvents>
    <Click OnEvent="SaveUserService">
    <ExtraParams>
    <ext:Parameter
    Name="values"
    Value="GridPanel3.getStore().getRowsValues()"
    Mode="Raw"
    Encode="true" />
    </ExtraParams>
    </Click>
    </DirectEvents>

    </ext:Button>


    and about the server side code i have not tried your list doctionary
    First try out the above code with your dictionay list code,if it does not work then try this

    protected void SaveUserService(object sender, DirectEventArgs e)
    {

    JArray jsonValues = JSON.Deserialize(e.ExtraParams("values"));
    //' Dim records As List(Of Dictionary(Of String, String)) = JSON.Deserialize(Of List(Of Dictionary(Of String, String)))(jsonValues)
    string result = "";

    foreach (JObject record in jsonValues) {
    result += record("Name").Value<string>();
    //'result &= record["ServiceName"] + " ";
    //'result &= record["Description"] + "<br />";
    //objStaff.FK_ServiceId = Convert.ToDecimal(record("ServiceId"))
    // objStaff.FK_StaffId = Convert.ToDecimal(cmbUser.Value)
    //X.Msg.Alert("Server", objStaff.FK_StaffId).Show()
    }
    }
  6. #16
    HI

    I guess ur logic for list dictionary will not work for the above problem..
    Try once..bt solution given by me will work 100%..You just need to access the records value by specifying the key in the for each loop
  7. #17
    Hi Hardik


    Actually the problem is here
    This is a methos in a class so here to insert the second row it goes to the Catch statement Data.SubmitChanges(); statement is not executing...

     #region "Insert"
            public void Insert()
            {
                try
                {
                    Data.StaffServiceDetails.InsertOnSubmit(this);
                    Data.SubmitChanges();
                }
                catch (Exception)
                {
                    
                }
            }
            #endregion
  8. #18
    HI
    Yeah its because when you use list dictionary for record values,it will work fine, if you'll have only column
    Bt if u have more than one column in the grid,then this will not work
    So the solution given by me will work perfectly ok

    All you need to do is


    protected void SaveUserService(object sender, DirectEventArgs e)
    {
    JArray jsonValues = JSON.Deserialize(e.ExtraParams("values"));


    foreach (JObject record in jsonValues) {
    objStaff.FK_ServiceId = Convert.ToDecimal(record("ServiceId").Value<string >());
    objStaff.FK_StaffId = Convert.ToDecimal(record("user").Value<string>());
    //'and so on.......

    }
    }

    what the above loop will do is
    inside the itiration it will be having all the column values of one particular row
    So it will loop to how many rows inside the grid.
    Dont worry try this solution it will work 100%
  9. #19
    Hi Hardik

    
     protected void SaveUserService(object sender, DirectEventArgs e)
            {
            
                JArray jsonValues = JSON.Deserialize<JArray>(e.ExtraParams["values"]);
                foreach (JObject record in jsonValues)
                {
                    objStaff.FK_ServiceId = Convert.ToDecimal(record["ServiceId"].Value<string>());
                    objStaff.FK_StaffId = Convert.ToDecimal(cmbUser.Value);
                    objStaff.Insert();
                }
               
            }
    I have the code which you suggest, but the same problem .... only one record goes to database.
  10. #20
    Hi

    How many records are there inside the grid from which u want to save the data?
Page 2 of 3 FirstFirst 123 LastLast

Similar Threads

  1. Add tabs to the tabpanel
    By Vaishali in forum 1.x Help
    Replies: 1
    Last Post: Oct 04, 2012, 11:23 AM
  2. Replies: 4
    Last Post: Jul 01, 2010, 1:49 AM
  3. Hi, Why the TabPanel cannot update 2 tabs?
    By bruce in forum 1.x Help
    Replies: 2
    Last Post: Apr 20, 2009, 10:25 PM

Posting Permissions