Is it possible

Last post 03-19-2009 4:02 PM by xxxd. 14 replies.
Page 1 of 1 (15 items)
Sort Posts: Previous Next
  • 03-19-2009 2:51 AM

    • sanusp
    • Top 75 Contributor
    • Joined on 03-12-2009
    • Wannabe Slacker
    • Points 110

    Is it possible

     

    Is it possible to do multiple/bulk updates in Ajax datacontrols. I have a scenario where the user checks his options and the user updates all the checks at one shot.

    Sanusp

  •  Advertisement

    Featured Advertisement

     
  • 03-19-2009 8:10 AM In reply to

    • Sonu
    • Top 10 Contributor
    • Joined on 05-22-2006
    • Montreal / Canada
    • Slacker
    • Points 12,183
    • MVP

    Re: Is it possible

    Can you please elaborate a bit more? Are you using the GridView to edit/update the rows?

    [MVP since 2005] [MCAD]
    Webmaster of DotNetSlackers
    Question or Suggestion?
    Feel free to ask my any .NET question
    Our Posting FAQ
  • 03-19-2009 8:12 AM In reply to

    • xxxd
    • Top 10 Contributor
    • Joined on 12-18-2006
    • Slacker
    • Points 19,057

    Re: Is it possible

     I would think it is possible. However like its server side gridview, it takes a lot of customized code to accomplish this. I will fiddle around to see if I can make this happen. Will let you know

  • 03-19-2009 8:22 AM In reply to

    • Sonu
    • Top 10 Contributor
    • Joined on 05-22-2006
    • Montreal / Canada
    • Slacker
    • Points 12,183
    • MVP

    Re: Is it possible

    The easiest and fastest way to achieve this is that you use the standard textbox in the GridView control along with the new Eval method to databind the values. Now instead of showing spans or something else then Grid will always stay in update mode. You will place a button outside the Gridview and when that button is pressed you loop though the rows get the value of each textbox and then update your database. Normally your GridView would look this:

    <AjaxData:GridView....>
    <Columns>
      <AjaxData:GridViewCommandColumn ShowEditButton="true" ShowDeleteButton="true" ShowCancelButton="true" .... />
      <AjaxData:GridViewBoundColumn HeaderText="Customer" DataField="Company" SortField="Company" ... />
      <AjaxData:GridViewBoundColumn HeaderText="Contact" DataField="ContactName" SortField="ContactName" ... />
    </Columns>
    </AjaxData:GridView>

    Now instead of doing that do this:

    <AjaxData:GridView....>
    <Columns>
      <AjaxData:GridTemplateColumn HeaderText="Customer">
        <ItemTemplate>
          <input type='textbox' value='{{ eval (Company) }} ' id='{{ eval (id) }}' />
        </ItemTemplate>
      </AjaxData:GridTemplateColumn>
    </Columns>
    </AjaxData:GridView>

    <input type='button' text='update' onclick='update()'>

    Does that make sense?

    [MVP since 2005] [MCAD]
    Webmaster of DotNetSlackers
    Question or Suggestion?
    Feel free to ask my any .NET question
    Our Posting FAQ
  • 03-19-2009 8:24 AM In reply to

    • Sonu
    • Top 10 Contributor
    • Joined on 05-22-2006
    • Montreal / Canada
    • Slacker
    • Points 12,183
    • MVP

    Re: Is it possible

    You could actually go even beyond that and add some cool jQuery or javascript effects to it, so that when the row is clicked then the input becomes visible, otherwise you just show the data. This would actually make a cool demo :)

    [MVP since 2005] [MCAD]
    Webmaster of DotNetSlackers
    Question or Suggestion?
    Feel free to ask my any .NET question
    Our Posting FAQ
    Filed under: ,
  • 03-19-2009 8:36 AM In reply to

    • sanusp
    • Top 75 Contributor
    • Joined on 03-12-2009
    • Wannabe Slacker
    • Points 110

    Re: Is it possible

    thanks guyss...well the scenario is simple..I noticed in the samples we have simple editing & complex editing...Instead of editing & updating a single row...all the rows which match the criteria..can be updated at one go....

     

    i agree we cud add jquery to input becomes visible...tht wud be nice.. let me see check tht 2.

     

  • 03-19-2009 9:35 AM In reply to

    • sanusp
    • Top 75 Contributor
    • Joined on 03-12-2009
    • Wannabe Slacker
    • Points 110

    Re: Is it possible

    sorry guys i have one more query to put forward...

    <AjaxData:GridViewCommandColumn ButtonType="Link"  ShowEditButton="true" ShowDeleteButton="true" ShowCancelButton="true" EditText="Edit me" DeleteText=" Delete Me" ShowSelectButton="true" SelectText="Save"  HeaderStyle-Wrap="false" ItemStyle-Wrap="false"/>

    how can i make use of the showselectbutton - ie in this row no need for any editing or deleting..it seems fine...

    SSP

  • 03-19-2009 9:43 AM In reply to

    • Sonu
    • Top 10 Contributor
    • Joined on 05-22-2006
    • Montreal / Canada
    • Slacker
    • Points 12,183
    • MVP

    Re: Is it possible

    See this code:

    http://code.assembla.com/AjaxDataControls/subversion/nodes/Sample/GridView/DifferentColumns.aspx

    [MVP since 2005] [MCAD]
    Webmaster of DotNetSlackers
    Question or Suggestion?
    Feel free to ask my any .NET question
    Our Posting FAQ
  • 03-19-2009 11:37 AM In reply to

    • sanusp
    • Top 75 Contributor
    • Joined on 03-12-2009
    • Wannabe Slacker
    • Points 110

    Re: Is it possible

     

    var newname = row.get_container().childNodes[nameColumnIndex].childNodes[0];
                      alert(newname.value.trim());

    in firebug i get can see the value..newname with row..but when i alert it like before object Text appears...

    by the way when is ADC ver 2.0 comin out...

     

     

  • 03-19-2009 12:02 PM In reply to

    • xxxd
    • Top 10 Contributor
    • Joined on 12-18-2006
    • Slacker
    • Points 19,057

    Re: Is it possible

     it is out, still in beta, testing phase

    Here is the source-code:
    http://code.assembla.com/AjaxDataControls/subversion/nodes
    You will see a download link on that page. You can also go into the individual folders and download only the files you need.
    The dll is at:
    http://code.assembla.com/AjaxDataControls/subversion/nodes/Sample/Bin

     

    The reason that the edit textbox disappear? is it because you hit update, then the gridview reset?

  • 03-19-2009 2:11 PM In reply to

    • sanusp
    • Top 75 Contributor
    • Joined on 03-12-2009
    • Wannabe Slacker
    • Points 110

    Re: Is it possible

    this is the function

    function onDeleteCommand(sender, e) {
                  var row = e.get_row();
                  var productId = _gridView.get_dataKeys()[e.get_row().get_rowIndex()];
                  var nameColumnIndex = _gridView.getColumnIndexByHeaderText('Name');
                  var newname = row.get_container().childNodes[nameColumnIndex].childNodes[0];
                 
                  if (confirm('Are you sure you want to delete' + newname + 'request?')) {
                   
                      var Id = _gridView.get_dataKeys()[e.get_row().get_rowIndex()];
                      alert(Id);
                    
                     // alert(newname.value.trim()); ---> I get like this 'Are you sure you want to delete' [objectText] request
                  }
              }

  • 03-19-2009 2:21 PM In reply to

    • xxxd
    • Top 10 Contributor
    • Joined on 12-18-2006
    • Slacker
    • Points 19,057

    Re: Is it possible

     how is that column defined? I suspect there is more controls inside the cell

  • 03-19-2009 2:30 PM In reply to

    • sanusp
    • Top 75 Contributor
    • Joined on 03-12-2009
    • Wannabe Slacker
    • Points 110

    Re: Is it possible

    <AjaxData:GridViewBoundColumn  HeaderText="Name" DataField="Name">

    <ItemStyle CssClass="formtext" Font-Size="Large" />

    </AjaxData:GridViewBoundColumn>

    when i put on the cursor on the newname in firebug...i can see the name....

  • 03-19-2009 2:47 PM In reply to

    • sanusp
    • Top 75 Contributor
    • Joined on 03-12-2009
    • Wannabe Slacker
    • Points 110

    Re: Is it possible

    solved it!!!

    Are you sure you want to delete  ' + newname.data + ' request?'

    not ---> newname /newname.value

     

    thnx sonu & xun for ur help

  • 03-19-2009 4:02 PM In reply to

    • xxxd
    • Top 10 Contributor
    • Joined on 12-18-2006
    • Slacker
    • Points 19,057

    Re: Is it possible

     I am a little puzzled by the solution. However glad it works

     

    thank you

Page 1 of 1 (15 items)