update tabcontainer without refreshing hole page

gameon 0 Tallied Votes 123 Views Share

here is my code i want update the two fields without refreshing whole page....

<ajaxToolkit:TabContainer ID="TabContainer1" runat="server" 
        OnClientActiveTabChanged="ActiveTabChanged" ActiveTabIndex="1" AutoPostBack="true">

<ajaxToolkit:TabPanel runat="server" ID="Panel1" HeaderText="View" >
<ContentTemplate>
<asp:UpdatePanel ID="updatePanel1" runat="server" OnLoad="updatePanel1_Load" UpdateMode="Conditional">
<ContentTemplate>
<table cellpadding='2' cellspacing='2' align="left" style="margin-top:0px">
<tr><td colspan='2'><h5 style="color:#008cd9">Personal Information</h5></td></tr>
<tr>
<td><asp:Label ID="_titlelbl" runat="server" Text="Title" CssClass="registration"></asp:Label></td>
<td>
   <asp:Label ID="_title" runat="server" CssClass="registration2"></asp:Label>
</td>
</tr>

<tr>
<td><asp:Label ID="_fNamelbl" runat="server" Text="First Name" CssClass="registration"></asp:Label></td>
<td>
       <asp:Label ID="_fName" runat="server" CssClass="registration2"></asp:Label>
</td>
</tr>

<tr>
<td><asp:Label ID="_mNamelbl" runat="server" Text="Middle Name" CssClass="registration"></asp:Label></td>
<td>   <asp:Label ID="_mName" runat="server" CssClass="registration2"></asp:Label>
</td>
</tr>

<tr>
<td><asp:Label ID="_lNamelbl" runat="server" Text="Last Name" CssClass="registration"></asp:Label></td>
<td>    <asp:Label ID="_lName" runat="server" CssClass="registration2"></asp:Label>
</td>
</tr>

<tr>
<td><asp:Label ID="_doblbl" runat="server" Text="Date of Birth" CssClass="registration"></asp:Label></td>
<td>   <asp:Label ID="_dob" runat="server" CssClass="registration2"></asp:Label>
</td>
</tr>

<tr>
<td><asp:Label ID="_genderlbl" runat="server" Text="Gender" CssClass="registration"></asp:Label></td>
<td>   <asp:Label ID="_gender" runat="server" CssClass="registration2"></asp:Label>
</td>
</tr>

<tr>
<td><asp:Label ID="_maritalStatuslbl" runat="server" Text="Masital Status" CssClass="registration"></asp:Label></td>
<td>   <asp:Label ID="_maritalStatus" runat="server" CssClass="registration2"></asp:Label></td>

</tr>

<tr>
<td><asp:Label ID="_languageslbl" runat="server" Text="Spoken Languages" CssClass="registration"></asp:Label></td>
<td>
      <asp:Label ID="_languages" runat="server" CssClass="registration2"></asp:Label>
</td>
</tr>

</table>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="TabContainer1" EventName="ActiveTabChanged" />
</Triggers>
</asp:UpdatePanel>
</ContentTemplate>

</ajaxToolkit:TabPanel>   

<ajaxToolkit:TabPanel runat="server" ID="TabPanel1" HeaderText="Edit">
<ContentTemplate>

<ContentTemplate>
<table cellpadding='2' cellspacing='2' align="left" style="margin-top:0px">
<tr><td colspan='2'><h5 style="color:#008cd9">Personal Information</h5></td></tr>
<tr>
<td><asp:Label ID="Label13" runat="server" Text="Marital Status" CssClass="registration"></asp:Label></td>
<td>   
    <asp:TextBox ID="_maritalstatustb" runat="server"></asp:TextBox>

</tr>

<tr>
<td><asp:Label ID="Label15" runat="server" Text="Spoken Languages" CssClass="registration"></asp:Label></td>
<td>
    <asp:TextBox ID="_languagetb" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
    <asp:Button ID="Button3" runat="server" Text="Update" OnClick="personalinfo_Click" /></td>
<td>
    <asp:Button ID="Button4" runat="server" Text="Reset" />
</tr>
</table>
</ContentTemplate>

</ContentTemplate>

</ajaxToolkit:TabPanel>

 </ajaxToolkit:TabContainer>





public partial class Employee_employeeProfile : System.Web.UI.Page
{
    connectivityClass c = new connectivityClass();
    protected void Page_Load(object sender, EventArgs e)
    {
        //if (!Page.IsPostBack)
        //{
            c.dts.Clear();
            c.adp = c.adapter("registration_sp");
            c.sel("registration_sp");
            c.adp.SelectCommand.Parameters.AddWithValue("@empid", "Smurfs/2012/1001");
            c.dts=c.viewdata("registration_tbl",3);
           _title.Text= c.dts.Tables["registration_tbl"].Rows[0][1].ToString();
           _fName.Text = c.dts.Tables["registration_tbl"].Rows[0][2].ToString();
           _mName.Text = c.dts.Tables["registration_tbl"].Rows[0][3].ToString();
           _lName.Text = c.dts.Tables["registration_tbl"].Rows[0][4].ToString();
           _dob.Text = c.dts.Tables["registration_tbl"].Rows[0][5].ToString();
           _gender.Text = c.dts.Tables["registration_tbl"].Rows[0][6].ToString();
           _maritalStatus.Text = c.dts.Tables["registration_tbl"].Rows[0][7].ToString();
           _languages.Text = c.dts.Tables["registration_tbl"].Rows[0][8].ToString();
           _address.Text = c.dts.Tables["registration_tbl"].Rows[0][9].ToString();
           _city.Text = c.dts.Tables["registration_tbl"].Rows[0]["city_name"].ToString();
           _state.Text = c.dts.Tables["registration_tbl"].Rows[0]["state_name"].ToString();
           _pinCode.Text = c.dts.Tables["registration_tbl"].Rows[0][10].ToString();
           _eMail.Text = c.dts.Tables["registration_tbl"].Rows[0][14].ToString();
           _eMail_1.Text = c.dts.Tables["registration_tbl"].Rows[0][15].ToString();
           _webAddress.Text = c.dts.Tables["registration_tbl"].Rows[0][16].ToString();
           _webAdderss_1.Text = c.dts.Tables["registration_tbl"].Rows[0][17].ToString();
           _imAddress.Text = c.dts.Tables["registration_tbl"].Rows[0][22].ToString();
           _imAddress_1.Text = c.dts.Tables["registration_tbl"].Rows[0][23].ToString();
           _phone.Text = c.dts.Tables["registration_tbl"].Rows[0][12].ToString();
           _phone1.Text = c.dts.Tables["registration_tbl"].Rows[0][13].ToString();
           _position.Text = c.dts.Tables["registration_tbl"].Rows[0][21].ToString();
           _location.Text = c.dts.Tables["registration_tbl"].Rows[0][22].ToString();
           _department.Text = c.dts.Tables["registration_tbl"].Rows[0][20].ToString();

        //}
    }


    protected void personalinfo_Click(object sender, EventArgs e)
    {
        //Response.Redirect("DiscussionForumMain.aspx");
        c.adp = c.adapter("registration_sp");
        c.upd("registration_sp");
        c.adp.UpdateCommand.Parameters.AddWithValue("@choice",4);
        c.adp.UpdateCommand.Parameters.AddWithValue("@mstatus",_maritalstatustb.Text);
        c.adp.UpdateCommand.Parameters.AddWithValue("@language",_languagetb.Text);
        c.adp.UpdateCommand.Parameters.AddWithValue("@empid", "Smurfs/2012/1001");
        c.update();
        
        //c.dts.Clear();
        //c.adp = c.adapter("registration_sp");
        //c.sel("registration_sp");
        //c.adp.SelectCommand.Parameters.AddWithValue("@empid", "Smurfs/2012/1001");
        //c.dts = c.viewdata("registration_tbl", 3);
        //_languages.Text = c.dts.Tables["registration_tbl"].Rows[0][8].ToString();
        //Response.Redirect("employeeProfile.aspx");
    }



    protected void updatePanel1_Load(object sender, EventArgs e)
    {
        
        c.dts.Clear();
        c.adp = c.adapter("registration_sp");
        c.sel("registration_sp");
        c.adp.SelectCommand.Parameters.AddWithValue("@empid", "Smurfs/2012/1001");
        c.dts = c.viewdata("registration_tbl", 3);
        _languages.Text = c.dts.Tables["registration_tbl"].Rows[0][8].ToString();

    }

}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.