Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. Populating Gridview on the value of Textbox

Populating Gridview on the value of Textbox

Scheduled Pinned Locked Moved ASP.NET
csharpasp-nethelpquestion
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    fahiemulleh
    wrote on last edited by
    #1

    "Someone has asked me to put this question in asp.net Forum. So, please make sure this is NOT DOUBLE Posting" Hi all. I have a textbox in which i will add "Comments" on aspx page along with an Add button. On this page , i have a gridview as well. The problem is, When i enter value in TEXTBOX and press ADD button, the value in textbox should have to be populated in Gridview without PAGE REFRESH. Please make sure the current scenario. I have a table ABC with a column Comments. I have to pull Data from ABC table in Gridview. so, when i add value in Textbox and press add button, basically it will save first in ABC table and then refresh the gridview behind the scene. Please let me know How I can achieve it. Thanks for your consideration

    T S 2 Replies Last reply
    0
    • F fahiemulleh

      "Someone has asked me to put this question in asp.net Forum. So, please make sure this is NOT DOUBLE Posting" Hi all. I have a textbox in which i will add "Comments" on aspx page along with an Add button. On this page , i have a gridview as well. The problem is, When i enter value in TEXTBOX and press ADD button, the value in textbox should have to be populated in Gridview without PAGE REFRESH. Please make sure the current scenario. I have a table ABC with a column Comments. I have to pull Data from ABC table in Gridview. so, when i add value in Textbox and press add button, basically it will save first in ABC table and then refresh the gridview behind the scene. Please let me know How I can achieve it. Thanks for your consideration

      T Offline
      T Offline
      ToddHileHoffer
      wrote on last edited by
      #2

      Your best bet would be to use some AJAX framework. We have purchased the telerik controls, so that is a piece of cake. You could probably accomplish this with ASPNet AJAX which is free.

      GameFly free trial

      1 Reply Last reply
      0
      • F fahiemulleh

        "Someone has asked me to put this question in asp.net Forum. So, please make sure this is NOT DOUBLE Posting" Hi all. I have a textbox in which i will add "Comments" on aspx page along with an Add button. On this page , i have a gridview as well. The problem is, When i enter value in TEXTBOX and press ADD button, the value in textbox should have to be populated in Gridview without PAGE REFRESH. Please make sure the current scenario. I have a table ABC with a column Comments. I have to pull Data from ABC table in Gridview. so, when i add value in Textbox and press add button, basically it will save first in ABC table and then refresh the gridview behind the scene. Please let me know How I can achieve it. Thanks for your consideration

        S Offline
        S Offline
        Sebastian M
        wrote on last edited by
        #3

        You can implement ICallbackEventHandler interface in your webpage and use client-callbacks to call the server when the Add button is pushed sending the text to be added as a param. You'll find the details on how to accomplish that here: http://msdn2.microsoft.com/en-US/library/system.web.ui.icallbackeventhandler.aspx Then, on the server side in the RaiseCallbackEvent method, add the text to the grid and render the grid to a StringWriter like this: StringWriter stringWriter = new StringWriter(CultureInfo.InvariantCulture); HtmlTextWriter htmlWriter = new HtmlTextWriter(stringWriter); yourGrid.RenderControl(htmlWriter); htmlWriter.Flush(); htmlWriter.Close(); string result = stringWriter.ToString(); You have to send back the result to the client side where you have to replace the outerHTML of the grid with the data you recive from the server. Your javascript function that recives the callback result and does the replacement should look something like this: function __onServerCallback(result, gridID) { else if (result.length) { // set the resulted data to the grid var grid = document.getElementById(gridID); grid.outerHTML = result; } } I hope this will help and I'm sure you will find good articles related to this subject on codeproject. Just search for ICallbackEventHandler. Sebastian M.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups