post back problem in table using jquery

Posted by Klbaiju under jQuery on 6/30/2011 | Points: 10 | Views : 1592 | Status : [Member] | Replies : 1
hi
this is my code for displaying in table

protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
bind();
}
}
public void bind()
{


SqlCommand cmd = new SqlCommand("select * from fullnames", conn);
conn.Open();
SqlDataReader dr = cmd.ExecuteReader();
Response.Write("<table border= '1' class='tab' >");
Response.Write("<thead>");
Response.Write("<tr ><th>Edit</th><th>FirstName</th><th >LastName</th></tr>");
Response.Write("</thead>");
Response.Write("<tbody>");
while (dr.Read())
{
Response.Write("<tr id=" + dr["id"].ToString() + " class='edit_tr'> ");
//<input type='Text' width='10px' value=" + dr["firstname"].ToString() + " class='editbox' id='first_input_" + dr["id"].ToString() + "'
Response.Write("<td><input type='Button' id=" + dr["id"].ToString() + " class='btn' width='10px' value='Edit'></td>");
Response.Write("<td id='edit_td' ><span id='first_" + dr["id"].ToString() + "' ToolTip='click for edit' class='text'>" + dr["firstname"].ToString() + " </span> <input type='Text' width='10px' value=" + dr["firstname"].ToString() + " class='editbox' id='first_input_" + dr["id"].ToString() + "' </td>");


Response.Write("<td id='edit_td' ><span id='last_" + dr["id"].ToString() + "' class='text'>" + dr["lastname"].ToString() + " </span><input type='Text' width='10px' value=" + dr["lastname"].ToString() + " class='editbox' id='last_input_" + dr["id"].ToString() + "' </td>");

Response.Write("</tr>");




}
Response.Write("</tbody>");
Response.Write("</table>");

this will display in atable

my problem is there is button outside this table

if press the button i want to change the value of a cell in table using jquery


like this


$('#btn1').click(function() {
var ID = $("#Text1").val();
$("#first_" +ID).html("arun");


});

$("#first_" +ID) is id of first cell in table

this is working but table will disappear .i think its prblem in postback

how to solve this

Regards
K L BAIJU




Responses

Posted by: Lakn2 on: 6/30/2011 [Member] Starter | Points: 25

Up
0
Down
put smartnavigation="true" in page directive
or

use updatepanel control

Thanks&Regards
LakshmiNarayana Nalluri.

Klbaiju, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response