Click here to Skip to main content
13,258,269 members (39,219 online)
Rate this:
Please Sign up or sign in to vote.
See more:
I am having a AJAX tab container with 8 tabs in which the Tab1 contains a DDL which is getting populated from the Database.

When the user selects one particular value a query is called and the following 3 text boxes are filled with the relative data. As follows:
private void LoadEnqNos() 
            string cmd = "SELECT EnqRef, EnqNo FROM EnquiryDetails"; 
            SqlDataAdapter da = new SqlDataAdapter(cmd, conn); 
            DataTable table = new DataTable(); 
            ddlEnqList.DataSource = table; 
        catch (Exception ex) 
            // Handle the error 
    protected void ddlEnqList_SelectedIndexChanged(object sender, EventArgs e) 
    private void getDetails() 
        DataTable details = new DataTable(); 
           SqlDataAdapter ad = new SqlDataAdapter("SELECT EnqTitle,ProjType,EnqType  
           FROM EnquiryDetails 
            WHERE EnqNo = '" + ddlEnqList.SelectedItem.Value + "'", conn); 
            if (details.Rows.Count > 0) 
                txtProjTitle.Text = details.Rows[0]["EnqTitle"].ToString(); 
                txtProjType.Text = details.Rows[0]["ProjType"].ToString(); 
                txtEnqType.Text = details.Rows[0]["EnqType"].ToString(); 
        catch (Exception ex) 
            // Handle the error 

Now the problem is that the above code was not working and my text boxes were blank but suddenly it started working when I made the property EnableViewState="true" of Tab Container1, as given below:

<cc1:TabContainer ID="TabContainer1"  runat="server" ActiveTabIndex="0" Width="870px" Height="327px" FontUnderline="False" Enabled="true" EnableTheming="True" ScrollBars="Auto" EnableViewState="false" style="margin-left: 0px">

But to my surprise after making the value true for the view state I am not able to take input data from users in the following 2nd,3rd,.... Tabs which were working fine before that.
<cc1:TabPanel  runat="server" HeaderText="Deliverables" ID="TabPanel2">
<table style="width: 827px"><tr>
    <td style="width: 64px; height: 32px"></td>
    <td class="style5"><asp:Label ID="Label2" runat="server" Font-Bold="True" 
            Font-Names="Verdana" Font-Size="17px" Height="24px" style="text-align: right" 
            Text="Enter Project Deliverables Details" Width="508px"></asp:Label>

</td><td style="width: 49px; height: 32px"></td>
    <tr><td style="width: 64px; height: 13px;"></td><td class="style6"></td>
        <td style="width: 49px; height: 13px;"></td>
        <td style="width: 50px; height: 13px; text-align: center;"> </td></tr></table>
<table style="width: 828px; height: 182px;">
    <tr><td class="style14"> </td>
        <td style="width: 166px; height: 20px"> </td>
        <td class="style12"></td></tr>
    <tr><td class="style13"> </td>
        <td style="width: 166px; ">
                <asp:GridView ID="GridviewProjDeliverables" runat="server" 
           AutoGenerateColumns="False" OnRowCommand="GridviewProjDeliverables_RowCommand" >
                <RowStyle Font-Size="Smaller" />
                    <Columns><asp:TemplateField HeaderText="Delivery Item"><ItemTemplate>
                            <asp:TextBox ID="txtDitem" runat="server" Text='<%# Bind("Item") %>'>
                        <asp:TemplateField HeaderText="Delivery Description">
                            <ItemTemplate><asp:TextBox ID="txtDesc" runat="server" Text='<%# Bind("Description") %>'>
                        <asp:TemplateField HeaderText="Quantity">
                            <ItemTemplate><asp:TextBox ID="txtQnty" runat="server" Text='<%# Bind("Quantity") %>'>
                        <asp:TemplateField HeaderText="Remarks">
                            <ItemTemplate><asp:TextBox ID="txtRemarks1" runat="server"   Text='<%# Bind("Remarks") %>'>
                </asp:TextBox></ItemTemplate></asp:TemplateField><asp:TemplateField HeaderText="Add"><ItemTemplate>
                                <asp:LinkButton ID="linkAdd" runat="server" 
                        <asp:TemplateField HeaderText="Remove">
                                <asp:LinkButton ID="linkRemove" runat="server" CausesValidation="false" 
                    <HeaderStyle Font-Size="XX-Small" /></asp:GridView>

And the code behind for that is....

public void SaveEstimationDetails() 
int intCnt = 0; 
for (int i = 0; i < GridviewProjDeliverables.Rows.Count; i++) 
TextBox txtDitem = (TextBox)GridviewProjDeliverables.Rows[i].Cells[0].FindControl("txtDitem"); 
TextBox txtDescription = (TextBox)GridviewProjDeliverables.Rows[i].Cells[1].FindControl("txtDesc"); 
TextBox txtQuantity = (TextBox)GridviewProjDeliverables.Rows[i].Cells[2].FindControl("txtQnty"); 
TextBox txtRemarks = (TextBox)GridviewProjDeliverables.Rows[i].Cells[3].FindControl("txtRemarks1"); 

After making the EnableViewState="true" my variables are not able to fetch the data inputed by user user and saying that the field is blank but if I am making it "false" then the controls on the Tabs are working fine but my drop down list functionality is not working... on Tab1..

So, Pls suggest some solution which will work for both the tabs proper functioning, without affecting their functionality.

thanks A lot in advance...
Tab1 with DDL
Tab2 with input boxes
Posted 29-May-12 22:10pm
Updated 1-Jun-12 2:56am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

I need more code for testing solution....
but, i've an alternative:

you can put getDetails() in a webservice (or PageMethod), put your 3 textbox bottom DDL in a Panel with DynamicPopulateExtender.
These are examples:[^][^][^]
Ashishkumar Patel 1-Jun-12 8:30am
If you can give me your email id then I'll send the project file to you.
My email is:
cpsglauco 1-Jun-12 9:13am
cpsglauco [simbol here] yahoo [dot here] it

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web04 | 2.8.171114.1 | Last Updated 1 Jun 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100