473,811 Members | 1,788 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Postback issue - ASP.NET

6 New Member
Hi there. I'm having an issue with autopostback, in that it doesn't seem to be working!
The webform I am using pulls the data from an AccessDataSourc e to populate the gridview, which has Edit and Delete functions. I have also configured it so that I can insert into the gridview using the footer row.
What I am now trying to do is create two searchable dropdowns in the header of the first two columns (company and reference) that would just return the chosen results, but when the options are clicked, the page just refreshes. Have trawled the internet and various books, but seem unable to find any answer; I think it's the way I am creating the dropdown? Since I've never been able to get a dropdown to filter the gridview.
I am using VB/.NET 2.0 and Visual Studio 2005. Any help as to why my postback isn't working would be fabulous!

The .aspx page:
Expand|Select|Wrap|Line Numbers
  1. <%@ Page Language="VB" AutoEventWireup="true" CodeFile="Default.aspx.vb" Inherits="_Default" enableviewstate="true" smartnavigation="false"%>
  2.  
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  4.  
  5. <html xmlns="http://www.w3.org/1999/xhtml">
  6. <head id="Head1" runat="server">
  7.     <title>Project Management</title>
  8.  
  9.  
  10.     <style type="text/css">
  11.         #Select1
  12.         {
  13.             height: 16px;
  14.             width: 32px;
  15.         }
  16.  
  17.     </style>
  18.  
  19.  
  20. </head>
  21. <body>
  22.     <form id="form1" runat="server">
  23.     <div style="font-family: Arial, Helvetica, sans-serif" >
  24.  
  25. <asp:AccessDataSource ID="AccessDataSource1" runat="server" 
  26. ConflictDetection="CompareAllValues" DataFile="~/App_Data/proman.mdb" 
  27. DeleteCommand="DELETE FROM [tbl1] WHERE [pmid] = @pmid"
  28. InsertCommand="INSERT INTO [tbl1] ([pmcom], [pmref], [pmdate], [pmtime], [pmnotes], [pmclosed], [pmfollowup]) VALUES (?, ?, ?, ?, ?, ?, ?)" 
  29. OldValuesParameterFormatString="original_{0}" 
  30. SelectCommand="SELECT [pmcom], [pmref], [pmdate], [pmtime], [pmnotes], [pmclosed], [pmfollowup], [pmid] FROM [tbl1]" 
  31. UpdateCommand="UPDATE [tbl1] SET [pmcom] = @pmcom, [pmref] = @pmref, [pmdate] = @pmdate, [pmtime] = @pmtime, [pmnotes] = @pmnotes, [pmclosed] = @pmclosed, [pmfollowup] = @pmfollowup WHERE [pmid] = @pmid" >
  32.  
  33.        <DeleteParameters>
  34.                 <asp:Parameter Name="original_pmid" Type="Int32" />
  35.         </DeleteParameters>
  36.         <UpdateParameters>
  37.                 <asp:Parameter Name="pmcom" Type="String" />
  38.                 <asp:Parameter Name="pmref" Type="String" />
  39.                 <asp:Parameter Name="pmdate" Type="DateTime" />
  40.                 <asp:Parameter Name="pmtime" Type="DateTime" />
  41.                 <asp:Parameter Name="pmnotes" Type="String" />
  42.                 <asp:Parameter Name="pmclosed" Type="DateTime" />
  43.                 <asp:Parameter Name="pmfollowup" Type="String" />
  44.                 <asp:Parameter Name="pmid" Type="Int32" />
  45.         </UpdateParameters>
  46.         <InsertParameters>
  47.                 <asp:Parameter Name="column1" Type="String" />
  48.                 <asp:Parameter Name="column2" Type="String" />
  49.                 <asp:Parameter Name="column3" Type="DateTime" />
  50.                 <asp:Parameter Name="column4" Type="DateTime" />
  51.                 <asp:Parameter Name="column5" Type="String" />
  52.                 <asp:Parameter Name="column6" Type="DateTime" />
  53.                 <asp:Parameter Name="column7" Type="String" />
  54.                 <asp:Parameter Name="column8" Type="Int32" />
  55.         </InsertParameters>
  56.         </asp:AccessDataSource>
  57.  
  58.  
  59.         <asp:AccessDataSource ID="AccessDataSource2" runat="server" 
  60.             DataFile="~/App_Data/proman.mdb" 
  61.             SelectCommand=" SELECT DISTINCT [pmcom] FROM [tbl1]"></asp:AccessDataSource>
continues:
Expand|Select|Wrap|Line Numbers
  1.  
  2.  
  3.         <asp:AccessDataSource ID="AccessDataSource3" runat="server" 
  4.             DataFile="~/App_Data/proman.mdb" 
  5.             SelectCommand="SELECT DISTINCT [pmref] FROM [tbl1]"></asp:AccessDataSource>
  6.         <h1>
  7.           <font color="#49724B">Project Management</font><br />
  8.  
  9.  
  10.         <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
  11.             DataKeyNames="pmid" DataSourceID="AccessDataSource1" ShowFooter="True" 
  12.             AllowPaging="True" BackColor="White" BorderColor="#336666" 
  13.             BorderStyle="Double" BorderWidth="3px" CellPadding="4" 
  14.             GridLines="Horizontal" style="font-size: small">
  15.             <FooterStyle BackColor="White" ForeColor="#333333" />
  16.             <RowStyle BackColor="White" ForeColor="#333333" />
  17.             <Columns>
  18.  
  19.  
  20. <asp:TemplateField ShowHeader="False">
  21.       <EditItemTemplate>
  22.               <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="True" CommandName="Update" Text="Update" Font-Bold="True" Font-Underline="False" ForeColor="MediumSeaGreen"></asp:LinkButton>
  23.               &nbsp;
  24.               <asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel" Font-Bold="True" Font-Underline="False" ForeColor="MediumSeaGreen"></asp:LinkButton>
  25.        </EditItemTemplate>
  26.        <FooterTemplate>
  27.                <asp:LinkButton ID="btnAdd" runat="server" Font-Bold="True" Font-Underline="False"
  28.                ForeColor="#49724B" OnClick="btnAdd_Click">Insert</asp:LinkButton>
  29.        </FooterTemplate>
  30.        <ItemTemplate>
  31.               <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" 
  32.                   CommandName="Edit" Text="Edit" Font-Bold="True" Font-Underline="False" 
  33.                   ForeColor="#49724B"></asp:LinkButton>
  34.                &nbsp;
  35.                <asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" 
  36.                   CommandName="Delete" Text="Delete" Font-Bold="True" Font-Underline="False" 
  37.                   ForeColor="#49724B"></asp:LinkButton>
  38.         </ItemTemplate>
  39. </asp:TemplateField>
  40.  
  41. <asp:TemplateField HeaderText="Company" SortExpression="pmcom" >
  42.         <EditItemTemplate>
  43.                <asp:DropDownList ID="DropDownList1" runat="server" Text='<%# Bind("pmcom") %>'>
  44.                <asp:ListItem Value="CEDAR"></asp:ListItem>
  45.                <asp:ListItem Value="EAN"></asp:ListItem>
  46.                <asp:ListItem Value="EFIN"></asp:ListItem>
  47.                <asp:ListItem Value="GBC"></asp:ListItem>
  48.                <asp:ListItem></asp:ListItem>
  49.                </asp:DropDownList>
  50.         </EditItemTemplate>
  51.         <FooterTemplate>
  52.                <asp:DropDownList ID="inspmcom" runat="server" AutoPostBack="False">
  53.                <asp:ListItem Value="CEDAR"></asp:ListItem>
  54.                <asp:ListItem Value="EAN"></asp:ListItem>
  55.                <asp:ListItem Value="EFIN"></asp:ListItem>
  56.                <asp:ListItem Value="GBC"></asp:ListItem>
  57.                <asp:ListItem></asp:ListItem>
  58.                </asp:DropDownList>
  59.         </FooterTemplate>
  60.         <HeaderTemplate>
  61.               <asp:LinkButton ID="pmcomlink" runat="server" ForeColor="White" OnClick="pmcomlink_Click">Company</asp:LinkButton>
  62.               <asp:DropDownList ID="pmcomdrop"  
  63.                 DataTextField="pmcom"
  64.                 AutoPostBack="true"
  65.                 OnSelectedIndexChanged="pmcomdrop_IndexChanged"
  66.                 OnPreRender="SetValue"
  67.                 DataSourceID="AccessDataSource2" runat="server"
  68.                 Visible="false"/>
  69.         </HeaderTemplate> 
  70.          <ItemTemplate>
  71.                 <asp:Label ID="Label1" runat="server" Text='<%# Bind("pmcom") %>'></asp:Label>
  72.          </ItemTemplate>
  73. </asp:TemplateField>
continues:
Expand|Select|Wrap|Line Numbers
  1.  
  2. <asp:TemplateField HeaderText="Reference" SortExpression="pmref">
  3.           <EditItemTemplate>
  4.                 <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("pmref") %>' 
  5.                      Width="75px"></asp:TextBox>
  6.           </EditItemTemplate>
  7.           <FooterTemplate>
  8.                 <asp:TextBox ID="inspmref" runat="server" Width="75px"></asp:TextBox>
  9.           </FooterTemplate>
  10.           <HeaderTemplate>
  11.                 <asp:LinkButton ID="pmreflink" runat="server" ForeColor="White" OnClick="pmreflink_Click">Reference</asp:LinkButton>
  12.                 <asp:DropDownList ID="pmrefdrop" runat="server" AutoPostBack="True" 
  13.                      DataSourceID="AccessDataSource3" DataTextField="pmref" 
  14.                      DataValueField="pmref" CausesValidation="True" Visible="false" OnSelectedIndexChanged="pmrefdrop_IndexChanged">
  15.                 </asp:DropDownList>
  16.            </HeaderTemplate>
  17.            <ItemTemplate>
  18.                 <asp:Label ID="Label2" runat="server" Text='<%# Bind("pmref") %>'></asp:Label>
  19.            </ItemTemplate>
  20. </asp:TemplateField>
  21.  
  22.  
  23. <asp:TemplateField HeaderText="Date" SortExpression="pmdate">
  24.            <EditItemTemplate>
  25.                 <asp:TextBox ID="TextBox3" runat="server" Text='<%# Bind("pmdate") %>' 
  26.                             Width="65px"></asp:TextBox>
  27.            </EditItemTemplate>
  28.            <FooterTemplate>
  29.                 <asp:TextBox ID="inspmdate" runat="server" Width="65px"></asp:TextBox> 
  30.                      &nbsp;<asp:Button ID="btnCal" runat="server" onclick="btnCal_Click" Text="..." 
  31.                      Width="29px" Height="21px" />
  32.            </FooterTemplate>
  33.            <ItemTemplate>
  34.                 <asp:Label ID="Label3" runat="server" Text='<%# Bind("pmdate", "{0:dd/MM/yy}") %>'></asp:Label>
  35.            </ItemTemplate>
  36. </asp:TemplateField>
  37.  
  38.  
  39. <asp:TemplateField HeaderText="Time" SortExpression="pmtime">
  40.           <EditItemTemplate>
  41.                 <asp:TextBox ID="TextBox4" runat="server" Text='<%# Bind("pmtime") %>' 
  42.                      Width="45px"></asp:TextBox>
  43.           </EditItemTemplate>
  44.           <FooterTemplate>
  45.                  <asp:TextBox ID="inspmtime" runat="server" Width="45px"></asp:TextBox>
  46.           </FooterTemplate>
  47.           <ItemTemplate>
  48.                 <asp:Label ID="Label4" runat="server" Text='<%# Bind("pmtime", "{0:HH:mm}") %>'></asp:Label>
  49.           </ItemTemplate>
  50. </asp:TemplateField>
  51.  
  52.  
  53. <asp:TemplateField HeaderText="Notes" SortExpression="pmnotes">
  54.           <EditItemTemplate>
  55.                 <asp:TextBox ID="TextBox5" runat="server" Text='<%# Bind("pmnotes") %>'></asp:TextBox>
  56.           </EditItemTemplate>
  57.           <FooterTemplate>
  58.                 <asp:TextBox ID="inspmnotes" runat="server"></asp:TextBox>
  59.           </FooterTemplate>
  60.           <ItemTemplate>
  61.                 <asp:Label ID="Label5" runat="server" Text='<%# Bind("pmnotes") %>'></asp:Label>
  62.           </ItemTemplate>
  63. </asp:TemplateField>
continues:
Expand|Select|Wrap|Line Numbers
  1.  
  2.  
  3. <asp:TemplateField HeaderText="Closed" SortExpression="pmclosed">
  4.           <EditItemTemplate>
  5.                 <asp:TextBox ID="TextBox6" runat="server" Text='<%# Bind("pmclosed") %>' 
  6.                      Width="65px"></asp:TextBox>
  7.           </EditItemTemplate>
  8.           <FooterTemplate>
  9.                 <asp:TextBox ID="inspmclosed" runat="server" Width="65px"></asp:TextBox>
  10.                 <asp:Button ID="btnCal2" runat="server" onclick="btnCal2_Click" Text="..." 
  11.                             Width="29px" Height="21px"/>
  12.           </FooterTemplate>
  13.           <ItemTemplate>
  14.                 <asp:Label ID="Label6" runat="server" Text='<%# Bind("pmclosed", "{0:dd/MM/yy}") %>'></asp:Label>
  15.           </ItemTemplate>
  16. </asp:TemplateField>
  17.  
  18.  
  19. <asp:TemplateField HeaderText="Followup" SortExpression="pmfollowup">
  20.           <EditItemTemplate>
  21.                 <asp:TextBox ID="TextBox7" runat="server" Text='<%# Bind("pmfollowup") %>'></asp:TextBox>
  22.           </EditItemTemplate>
  23.           <FooterTemplate>
  24.                 <asp:TextBox ID="inspmfollowup" runat="server"></asp:TextBox>
  25.           </FooterTemplate>
  26.           <ItemTemplate>
  27.                 <asp:Label ID="Label7" runat="server" Text='<%# Bind("pmfollowup") %>'></asp:Label>
  28.           </ItemTemplate>
  29. </asp:TemplateField>
  30.  
  31.  
  32. <asp:TemplateField HeaderText="ID" InsertVisible="False" SortExpression="pmid" Visible="False">
  33.           <EditItemTemplate>
  34.                 <asp:Label ID="Label1" runat="server" Text='<%# Eval("pmid") %>'></asp:Label>
  35.           </EditItemTemplate>
  36.           <FooterTemplate>
  37.                 <asp:TextBox ID="inspmid" runat="server" Width="50px"></asp:TextBox>
  38.           </FooterTemplate>
  39.           <ItemTemplate>
  40.                 <asp:Label ID="Label8" runat="server" Text='<%# Bind("pmid") %>'></asp:Label>
  41.           </ItemTemplate>
  42. </asp:TemplateField>
  43.  
  44. </Columns>
  45.  
  46.  
  47. <PagerStyle BackColor="#336666" ForeColor="White" HorizontalAlign="Center" />
  48. <SelectedRowStyle BackColor="#339966" Font-Bold="True" ForeColor="White" />
  49. <HeaderStyle BackColor="#336666" Font-Bold="True" ForeColor="White" />
  50. </asp:GridView>
  51.  
  52. </h1>
  53.  
  54. </div>
  55.  
  56. <center>  
  57. <asp:Calendar ID="Calendar1" runat="server" BackColor="White" BorderColor="White" 
  58.             Font-Names="Verdana" Font-Size="9pt" ForeColor="Black" Height="180px" 
  59.             Width="200px" Visible="False" NextPrevFormat="ShortMonth" BorderWidth="1px">
  60.         <SelectedDayStyle BackColor="#333333" ForeColor="White" />
  61.         <TodayDayStyle BackColor="#CCCCCC" />
  62.         <OtherMonthDayStyle ForeColor="#999999" />
  63.         <NextPrevStyle VerticalAlign="Bottom" Font-Bold="True" Font-Size="8pt" 
  64.             ForeColor="#333333" />
  65.         <DayHeaderStyle Font-Bold="True" Font-Size="8pt" />
  66.         <TitleStyle BackColor="White" ForeColor="#333333" Font-Bold="True" 
  67.             Font-Size="8pt" BorderColor="Black" BorderWidth="4px"  />
  68.     </asp:Calendar>
  69.  
  70.  
  71. <asp:Calendar ID="Calendar2" runat="server" BackColor="White" BorderColor="White" 
  72.             Font-Names="Verdana" Font-Size="9pt" ForeColor="Black" Height="180px" 
  73.             Width="200px" Visible="False" NextPrevFormat="ShortMonth" BorderWidth="1px">
  74.         <SelectedDayStyle BackColor="#333333" ForeColor="White" />
  75.         <TodayDayStyle BackColor="#CCCCCC" />
  76.         <OtherMonthDayStyle ForeColor="#999999" />
  77.         <NextPrevStyle VerticalAlign="Bottom" Font-Bold="True" Font-Size="8pt" 
  78.             ForeColor="#333333" />
  79.         <DayHeaderStyle Font-Bold="True" Font-Size="8pt" />
  80.         <TitleStyle BackColor="White" Font-Bold="True" Font-Size="8pt" 
  81.             ForeColor="#333333" BorderColor="Black" BorderWidth="4px" />
  82.     </asp:Calendar>
  83.     </center>
  84.    </form>
  85.    </body>
  86.    </html>
and the .aspx.vb page

Expand|Select|Wrap|Line Numbers
  1. Partial Class _Default
  2.     Inherits System.Web.UI.Page
  3.  
  4.     Protected Sub btnAdd_Click(ByVal sender As Object, ByVal e As EventArgs)
  5.         Dim column1 As DropDownList = TryCast(GridView1.FooterRow.FindControl("inspmcom"), DropDownList)
  6.         Dim column2 As TextBox = TryCast(GridView1.FooterRow.FindControl("inspmref"), TextBox)
  7.         Dim column3 As TextBox = TryCast(GridView1.FooterRow.FindControl("inspmdate"), TextBox)
  8.         Dim column4 As TextBox = TryCast(GridView1.FooterRow.FindControl("inspmtime"), TextBox)
  9.         Dim column5 As TextBox = TryCast(GridView1.FooterRow.FindControl("inspmnotes"), TextBox)
  10.         Dim column6 As TextBox = TryCast(GridView1.FooterRow.FindControl("inspmclosed"), TextBox)
  11.         Dim column7 As TextBox = TryCast(GridView1.FooterRow.FindControl("inspmfollowup"), TextBox)
  12.         Dim column8 As TextBox = TryCast(GridView1.FooterRow.FindControl("inspmid"), TextBox)
  13.  
  14.         'insert statement. alsi insert into primary key column but insert statement needs to show
  15.         ' values without primary key
  16.         AccessDataSource1.InsertParameters("column1").DefaultValue = column1.SelectedValue
  17.         AccessDataSource1.InsertParameters("column2").DefaultValue = column2.Text
  18.         AccessDataSource1.InsertParameters("column3").DefaultValue = column3.Text
  19.         AccessDataSource1.InsertParameters("column4").DefaultValue = column4.Text
  20.         AccessDataSource1.InsertParameters("column5").DefaultValue = column5.Text
  21.         AccessDataSource1.InsertParameters("column6").DefaultValue = column6.Text
  22.         AccessDataSource1.InsertParameters("column7").DefaultValue = column7.Text
  23.         AccessDataSource1.InsertParameters("column8").DefaultValue = column8.Text
  24.  
  25.         AccessDataSource1.Insert()
  26.     End Sub
  27.  
  28.  
  29.     Protected Sub inspmdate_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) _
  30.         Handles GridView1.DataBound
  31.  
  32.         Dim inspmdate As TextBox = TryCast(GridView1.FooterRow.FindControl("inspmdate"), TextBox)
  33.         If inspmdate IsNot Nothing Then
  34.             inspmdate.Text = DateTime.Today.ToString("dd/MM/yy")
  35.         End If
  36.  
  37.         Dim inspmtime As TextBox = TryCast(GridView1.FooterRow.FindControl("inspmtime"), TextBox)
  38.         If inspmtime IsNot Nothing Then
  39.             inspmtime.Text = DateTime.Now.ToString("HH:mm")
  40.         End If
  41.  
  42.         Dim inspmclosed As TextBox = TryCast(GridView1.FooterRow.FindControl("inspmclosed"), TextBox)
  43.         If inspmclosed IsNot Nothing Then
  44.             inspmclosed.Text = DateTime.Today.ToString("dd/MM/yy")
  45.         End If
  46.  
  47.     End Sub
  48.  
  49.     Protected Sub btnCal_Click(ByVal sender As Object, ByVal e As System.EventArgs)
  50.         Dim inspmdate As TextBox = TryCast(GridView1.FooterRow.FindControl("inspmdate"), TextBox)
  51.         Dim Calendar1 As Calendar = TryCast(form1.FindControl("Calendar1"), Calendar)
  52.  
  53.         Try
  54.             If inspmdate.Text.Trim() <> "" Then
  55.                 Calendar1.SelectedDate = Convert.ToDateTime(inspmdate.Text)
  56.             End If
  57.         Catch
  58.         End Try
  59.         'shows the calendar...
  60.         Calendar1.Visible = True
  61.  
  62.     End Sub
  63.  
  64.     Protected Sub Calendar1_SelectionChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Calendar1.SelectionChanged
  65.         Dim inspmdate As TextBox = TryCast(GridView1.FooterRow.FindControl("inspmdate"), TextBox)
  66.         Dim Calendar1 As Calendar = TryCast(form1.FindControl("Calendar1"), Calendar)
  67.         '...displays the date in the textbox... 
  68.         inspmdate.Text = Calendar1.SelectedDate.ToString()
  69.         '...and hides the calendar again
  70.         Calendar1.Visible = False
  71.  
  72.     End Sub
  73.  
  74.     Protected Sub btnCal2_Click(ByVal sender As Object, ByVal e As System.EventArgs)
  75.         Dim inspmclosed As TextBox = TryCast(GridView1.FooterRow.FindControl("inspmclosed"), TextBox)
  76.         Dim Calendar2 As Calendar = TryCast(form1.FindControl("Calendar2"), Calendar)
  77.  
  78.         Try
  79.             If inspmclosed.Text.Trim() <> "" Then
  80.                 Calendar2.SelectedDate = Convert.ToDateTime(inspmclosed.Text)
  81.             End If
  82.         Catch
  83.         End Try
  84.         'shows the calendar...
  85.         Calendar2.Visible = True
  86.     End Sub
  87.     Protected Sub Calendar2_SelectionChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Calendar2.SelectionChanged
  88.         Dim inspmclosed As TextBox = TryCast(GridView1.FooterRow.FindControl("inspmclosed"), TextBox)
  89.         Dim Calendar2 As Calendar = TryCast(form1.FindControl("Calendar2"), Calendar)
  90.         '...displays the date in the textbox... 
  91.         inspmclosed.Text = Calendar2.SelectedDate.ToString()
  92.         '...and hides the calendar again
  93.         Calendar2.Visible = False
  94.  
  95.     End Sub
  96.  
  97.     Protected Sub pmcomlink_Click(ByVal sender As Object, ByVal e As System.EventArgs)
  98.         Dim pmcomlink As LinkButton = TryCast(GridView1.HeaderRow.FindControl("pmcomlink"), LinkButton)
  99.         Dim pmcomdrop As DropDownList = TryCast(GridView1.HeaderRow.FindControl("pmcomdrop"), DropDownList)
  100.         'shows dropdown when linkbutton clicked
  101.         pmcomdrop.Visible = True
  102.         pmcomlink.Visible = False
  103.     End Sub
  104.     Protected Sub pmreflink_Click(ByVal sender As Object, ByVal e As System.EventArgs)
  105.         Dim pmreflink As LinkButton = TryCast(GridView1.HeaderRow.FindControl("pmreflink"), LinkButton)
  106.         Dim pmrefdrop As DropDownList = TryCast(GridView1.HeaderRow.FindControl("pmrefdrop"), DropDownList)
  107.         'shows dropdown when link button clicked
  108.         pmrefdrop.Visible = True
  109.         pmreflink.Visible = False
  110.     End Sub
  111.  
  112.     Protected Sub pmcomdrop_IndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)
  113.         Dim pmcomlink As LinkButton = TryCast(GridView1.HeaderRow.FindControl("pmcomlink"), LinkButton)
  114.         Dim pmcomdrop As DropDownList = TryCast(GridView1.HeaderRow.FindControl("pmcomdrop"), DropDownList)
  115.         '  hides dropdown when a company is selected and show the linkbutton
  116.         pmcomdrop.Visible = False
  117.         pmcomlink.Visible = True
  118.  
  119.  
  120.     End Sub
  121.  
  122.     Protected Sub pmrefdrop_IndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)
  123.         Dim pmreflink As LinkButton = TryCast(GridView1.HeaderRow.FindControl("pmreflink"), LinkButton)
  124.         Dim pmrefdrop As DropDownList = TryCast(GridView1.HeaderRow.FindControl("pmrefdrop"), DropDownList)
  125.         ' hide the dropdown when a reference is selected and show the link button
  126.         pmrefdrop.Visible = False
  127.         pmreflink.Visible = True
  128.     End Sub
  129.  
  130.  
  131.  
  132.     Protected Sub SetValue(ByVal sender As Object, ByVal e As EventArgs)
  133.  
  134.     End Sub
  135.  
  136.  
  137. End Class
Many thanks!
Apr 7 '08 #1
1 1972
balame2004
142 New Member
Hi,

Declare all the dropdown lists as Static(Shared) and try.

Eg:

Shared column1 As DropDownList


Regards,
Balaji U
Apr 10 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
4714
by: Rhys | last post by:
I have a page which has an IFrame on it. The src of the IFrame is a page with a datagrid on it. The Datagrid has bound template columns. The columns of the datagrid pass the bound data value of each cell within it to my code behind file which generates the HTML to display the data in a formatted text box, some of which is editable, some of which is not. The idea here is that the user can look at a page with a scrolling 'window'. Move...
7
1850
by: Anand | last post by:
Hi All, The postback on my desktop stopped working. I am trying to run the webapplication locally on my desktop and the Postback on my home page won't trigger on any of my dropdown selections. The error on the displayed HTML points to the line in the PostBack event which is not my code but the auto generated code for the postback event. Have anybody else faced this issue. Any help appreciated. Thanks Anand
5
2435
by: Tom Anderson | last post by:
I am currently having an issue with an ASP.Net 1.1 Web page that does the following remotely but not locally. Click on a control Check for postback, if postback, handle the event, otherwise populate page with options. What is happening is that remotely the page is doing a double postback, then doing a post without data at all resulting in the event being fired twice, then redirecting to the incorrect option in a dropdown (going to...
2
620
by: Wizzard | last post by:
I have a repeater with and imagebutton on a page useing VS2005 ASP.Net 2.0 <asp:Repeater ID="Repeater1" runat="server" > <ItemTemplate> <div> <asp:ImageButton ImageUrl="button.gif" ID="ImageButton1" runat="server" /> <p><%# Eval("Name") %></p> </div> </ItemTemplate>
1
1375
by: Jason | last post by:
I have a webpage that I've wrapped in an Atlas UpdatePanel. This page contains four textboxes, each with AutoPostBack set to true. The problem comes when someone edits the first box and tabs to the second box. They have enough time to make a quick edit to the second box before the postback completes and then the value in the second textbox is reset to the original value. Is there anything I can do about this? It's really causing...
3
2762
by: teo | last post by:
Mozilla error on postback and validation ----------- A Button causes a Listbox to desappear. If no item has been selected on the Listbox, all is OK. If one or more items are selected,
11
14833
by: antonyliu2002 | last post by:
I know that this has been asked and answered thousands of times. As a matter of fact, I know that I need to say If Not Page.IsPostBack Then 'Do something End If for things that needs to be processed by the web server. I am still struggling to understand this postback logic, and hope that some kind gurus out there could help me clarify the confusion I have.
6
2906
by: Dmitry Duginov | last post by:
Hi, I have the following label markup (label is inside FormView): <asp:Label ID="lblIndicatorReady" runat="server" Text="RE" ToolTip="Ready" BackColor='<%# Eval("Ready").ToString()=="True"?System.Drawing.Color.FromName("#FFFF80"):System.Drawing.Color.White %>' Enabled='<%# Eval("Ready") %>'
2
2107
by: =?Utf-8?B?SlA=?= | last post by:
Hi all. I'm having a problem with a postback issue and I think it's cache related. Here's my setup: I have a web site that has a signup section. This has simple things like name, age, birth date, etc. When the user visits this page for the first time, a person's data object that is used to store the user's name, age, birth date, etc. is created and stored in session. On the first visit to this page, the object is empty. Whenever the...
4
1505
by: Doogie | last post by:
Basically, I have two custom dates the user can enter via a popup calendar. These dates are stored into text boxes. Then the user can click a button (Run Report) and those values (as well as others) are used to build an SRS url string. This used to work before I modified the page to make the calendar a popup. Now, the text boxes lose their value when the user clicks the run report button. I have verified this is happening because...
0
9728
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9605
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10389
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10402
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9205
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7670
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5692
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4339
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3018
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.