ASP Ajax Update Panel

Discussion in 'ASP .Net' started by AdonisL81, Apr 13, 2008.

  1. AdonisL81

    AdonisL81 Guest

    Hello,
    I am new to .NET I am having trouble with a asp update panel
    and Gridview.

    The Gridview control is inside the update panel and I am trying to
    have the gridview update from a form button. The form updates the
    database from which the gridview pulls data.

    The panel and gridview works if I do a postback from within the
    gridview such as sorting. but I can not get it to work from the
    button. here is my code.

    I'm sure I missed something but if anyone can help that would be
    appreciated

    <%@ Page Language="VB" AutoEventWireup="true"
    CodeFile="Default.aspx.vb" Inherits="_Default" %>
    <%@ Register Assembly="AjaxControlToolkit"
    Namespace="AjaxControlToolkit" TagPrefix="cc1" %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/
    TR/xhtml11/DTD/xhtml11.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
    <title>Untitled Page</title>
    <link href="StyleSheet.css" rel="stylesheet" type="text/css" />
    </head>
    <body>

    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server" />
    <div>
    </div>




    <div id="wrapper">
    <div id="input">


    <label >Department:</label>
    <asp:DropDownList ID="DropDownList1" runat="server">
    <asp:ListItem></asp:ListItem>
    <asp:ListItem>ADMN</asp:ListItem>
    <asp:ListItem>OTHER</asp:ListItem>
    <asp:ListItem>TEST</asp:ListItem>
    </asp:DropDownList>
    <br />
    <br />
    <label >Type of Hours:</label>

    <asp:DropDownList ID="DropDownList2" runat="server"
    Height="16px" Width="42px" >
    <asp:ListItem></asp:ListItem>
    <asp:ListItem>1</asp:ListItem>
    <asp:ListItem>2</asp:ListItem>
    <asp:ListItem>3</asp:ListItem>
    <asp:ListItem>4</asp:ListItem>
    </asp:DropDownList>
    <br />
    <br />
    <label>Hours:</label>
    <asp:TextBox ID="TextBox1"
    runat="server" Width="50px"></asp:TextBox>
    <br />
    <br />
    <label>Date:</label><asp:TextBox ID="TextBox3" runat="server"></
    asp:TextBox>
    <cc1:CalendarExtender ID="CalendarExtender1" runat="server"
    Format="M/d/yyyy"
    TargetControlID="textbox3">
    </cc1:CalendarExtender>

    <asp:RangeValidator ID="RangeValidator1" runat="server"
    ControlToValidate="TextBox3" ErrorMessage="RangeValidator"
    Type="Date"></asp:RangeValidator>

    <br />
    <label>Job Number:</label>
    <asp:DropDownList ID="DropDownList3" runat="server"
    AutoPostBack="True">
    <asp:ListItem></asp:ListItem>
    <asp:ListItem>1234</asp:ListItem>
    <asp:ListItem>1234</asp:ListItem>
    <asp:ListItem>5678</asp:ListItem>
    <asp:ListItem>7896</asp:ListItem>
    <asp:ListItem>1236</asp:ListItem>
    </asp:DropDownList>
    <br />
    <br />
    <label>Phase:</label>
    <asp:DropDownList ID="DropDownList4" runat="server"
    AutoPostBack="True">
    <asp:ListItem>MISC</asp:ListItem>
    <asp:ListItem>ADMN</asp:ListItem>
    <asp:ListItem>TEST</asp:ListItem>
    <asp:ListItem>Other</asp:ListItem>
    </asp:DropDownList>
    <br />
    <br />
    <label>Category:</label>
    <asp:DropDownList ID="DropDownList5" runat="server"
    AutoPostBack="True">
    <asp:ListItem>TEST</asp:ListItem>
    <asp:ListItem>NEXT</asp:ListItem>
    <asp:ListItem>ONE</asp:ListItem>
    <asp:ListItem>LAST</asp:ListItem>
    </asp:DropDownList>
    <br />
    <br />
    <label>Description:</label>
    <asp:TextBox ID="TextBox2"
    runat="server" Height="150px" Width="200px"></asp:TextBox>
    <br />

    <br />
    <asp:Button ID="Button1" runat="server" Text="Add Time"
    style="height: 26px"/>
    </div>


    <asp:UpdatePanel ID="UpdatePanel1" runat="server" >
    <ContentTemplate>

    <asp:GridView ID="GridView1" runat="server"
    AllowPaging="True"
    AllowSorting="True" DataSourceID="GetUserTime"
    AutoGenerateColumns="False" DataKeyNames="id" >
    <Columns>
    <asp:CommandField ShowDeleteButton="True"
    ShowEditButton="True" />
    <asp:BoundField DataField="Initials"
    HeaderText="Initials"
    SortExpression="Initials" />
    <asp:BoundField DataField="Dept" HeaderText="Dept"
    SortExpression="Dept" />
    <asp:BoundField DataField="HourType"
    HeaderText="HourType"
    SortExpression="HourType" />
    <asp:BoundField DataField="Hours" HeaderText="Hours"
    SortExpression="Hours" />
    <asp:BoundField DataField="Date" HeaderText="Date"
    SortExpression="Date" />
    <asp:BoundField DataField="Job#" HeaderText="Job#"
    SortExpression="Job#" />
    <asp:BoundField DataField="Phase" HeaderText="Phase"
    SortExpression="Phase" />
    <asp:BoundField DataField="Category"
    HeaderText="Category"
    SortExpression="Category" />
    <asp:BoundField DataField="Description"
    HeaderText="Description"
    SortExpression="Description" />
    </Columns>
    </asp:GridView>
    </ContentTemplate>
    <Triggers>
    <asp:AsyncPostBackTrigger ControlID="Button1"
    EventName="Click"/>
    </Triggers>
    </asp:UpdatePanel>
    AdonisL81, Apr 13, 2008
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?cm9kY2hhcg==?=

    datalist and ajax update panel

    =?Utf-8?B?cm9kY2hhcg==?=, Oct 2, 2006, in forum: ASP .Net
    Replies:
    2
    Views:
    715
    =?Utf-8?B?cm9kY2hhcg==?=
    Oct 2, 2006
  2. =?Utf-8?B?cm9kY2hhcg==?=

    ajax update panel trigger

    =?Utf-8?B?cm9kY2hhcg==?=, Oct 6, 2006, in forum: ASP .Net
    Replies:
    2
    Views:
    514
    =?Utf-8?B?cm9kY2hhcg==?=
    Oct 7, 2006
  3. GaryDean

    AJAX Update Panel w I.E.7 Problem

    GaryDean, Dec 4, 2006, in forum: ASP .Net
    Replies:
    10
    Views:
    5,009
    Steven Cheng[MSFT]
    Dec 12, 2006
  4. =?Utf-8?B?Qw==?=

    ASP.NET Ajax Update Panel in ContentPlaceHolder

    =?Utf-8?B?Qw==?=, Feb 12, 2007, in forum: ASP .Net
    Replies:
    0
    Views:
    1,292
    =?Utf-8?B?Qw==?=
    Feb 12, 2007
  5. DanWeaver
    Replies:
    2
    Views:
    551
    =?Utf-8?B?TWlsb3N6IFNrYWxlY2tpIFtNQ0FEXQ==?=
    Feb 22, 2007
Loading...

Share This Page