c# - returning data into textboxes without postback -


i have form has reference number , notes field. this:

ref notes

in database have multiple rows:

1234 | note1 | 20/03/2013 18:44 1234 | note2 | 20/03/2013 18:45

i show recent notes in text box. need show reference number too.

i do:

sqlconnection conn = new sqlconnection(connection_string); sqlcommand comm1 = new sqlcommand(command, conn); conn.open(); sqldatareader dr1 = comm1.executereader(); if (dr1.read()) {     textbox.text = dr1.getvalue(0).tostring(); } conn.close(); 

but there more elegant solution allows me click between each record without postback?

if avoiding full postback going use ajax (short asynchronous javascript , xml).

you have 2 popular options

  1. use microsoft ajax implementation comes asp.net framework , make use of updatepanel , other controls
  2. use jquery ajax

if have idea on jquery library , data structures used in jquery, go jquery ajax more easy use.

from jquery - ajax introduction

‘writing regular ajax code can bit tricky, because different browsers have different syntax ajax implementation. means have write code test different browsers. however, jquery team has taken care of us, can write ajax functionality 1 single line of code.’

references

channel9.msdn.com - how i: make ajax calls using jquery?


Comments

Popular posts from this blog

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

java - Could not locate OpenAL library -

sorting - opencl Bitonic sort with 64 bits keys -