ASP.NET - and it seems so simple...

Asked By Christopher Baker on 24-Apr-09 02:03 PM

I have a page with a tab control. On one of the tabs I want a button (or a link of some sort) that will refresh a GridView on one of the tabs. I can't seem to get the button (or link) to even fire code. 

<ajaxToolkit:TabPanel ID="tabPanelViewTransactions" HeaderText="View transactions" runat="server">

<ContentTemplate>

<asp:Label ID="Label6" runat="server" Font-Names="Verdana" Text="Start date" /> 

<asp:TextBox ID="txtStartDate" runat="server" Font-Names="Verdana" Font-Size="Small" Width="100px" text="1/1/2026" />    

<asp:Label ID="Label7" runat="server" Font-Names="Verdana" Text="End date" /> 

<asp:TextBox ID="txtEndDate" runat="server" Font-Names="Verdana" Font-Size="Small" Width="100px" Text="" />       

<asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />

 

<asp:LinkButton ID="lnkbtnRefreshGrid" runat="server" Width="168px">Refresh the grid</asp:LinkButton>

<ajaxToolkit:CalendarExtender ID="CalendarExtender2" runat="server" TargetControlID="txtStartDate" />

      

<ajaxToolkit:CalendarExtender ID="CalendarExtender3" runat="server" TargetControlID="txtEndDate" />

 

<br /><br />

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

<ContentTemplate>

<asp:GridView ID="grdTransactions" runat="server" AutoGenerateColumns="False" DataSourceID="dsTransactions"

Font-Names="Verdana" Font-Size="Small" BorderColor="Black" BorderStyle="Solid" Caption="Transactions">

<HeaderStyle CssClass="dataGridHeader" />

<Columns>

<asp:BoundField DataField="ACCOUNT_NAME" HeaderText="ACCOUNT" HeaderStyle-HorizontalAlign="left"

ItemStyle-Width="200px" SortExpression="ACCOUNT_NAME">

<HeaderStyle HorizontalAlign="Left" />

<ItemStyle Width="200px" />

</asp:BoundField>

<asp:BoundField DataField="TRANSACTION_DATE" HeaderText="TRANSACTION DATE" HeaderStyle-HorizontalAlign="left"

ItemStyle-Width="150px" SortExpression="TRANSACTION_DATE"

DataFormatString="{0:MM-dd-yyyy}" >

<HeaderStyle HorizontalAlign="Left" />

<ItemStyle Width="150px" />

</asp:BoundField>

<asp:BoundField DataField="PAYEE_NAME" HeaderText="PAYEE" HeaderStyle-HorizontalAlign="left"

ItemStyle-Width="150px" SortExpression="PAYEE_NAME" >

<HeaderStyle HorizontalAlign="Left" />

<ItemStyle Width="150px" />

</asp:BoundField>

<asp:BoundField DataField="AMOUNT" HeaderText="AMOUNT" HeaderStyle-HorizontalAlign="Right"

ItemStyle-HorizontalAlign="Right" ItemStyle-Width="100px" SortExpression="AMOUNT"

DataFormatString="{0:$#,###.##}" >

<HeaderStyle HorizontalAlign="Right" />

<ItemStyle HorizontalAlign="Right" Width="100px" />

</asp:BoundField>

<asp:BoundField DataField="DESCRIPTION" HeaderText="PAID VIA" HeaderStyle-HorizontalAlign="Center"

ItemStyle-HorizontalAlign="Center" ItemStyle-Width="100px" SortExpression="DESCRIPTION" >

<HeaderStyle HorizontalAlign="Center" />

<ItemStyle HorizontalAlign="Center" Width="100px" />

</asp:BoundField>

<asp:CheckboxField DataField="OFF_BUDGET" HeaderText="OFF BUDGET" HeaderStyle-HorizontalAlign="Center"

ItemStyle-HorizontalAlign="Center" ItemStyle-Width="100px" SortExpression="OFF_BUDGET" >

<HeaderStyle HorizontalAlign="Center" />

<ItemStyle HorizontalAlign="Center" Width="100px" />

</asp:CheckboxField>

<asp:CheckboxField DataField="DEDUCT_FROM_BA" HeaderText="DEDUCT BA" HeaderStyle-HorizontalAlign="Center"

ItemStyle-HorizontalAlign="Center" ItemStyle-Width="100px" SortExpression="DEDUCT_FROM_BA" >

<HeaderStyle HorizontalAlign="Center" />

<ItemStyle HorizontalAlign="Center" Width="100px" />

</asp:CheckboxField>

<asp:BoundField DataField="COMMENT" HeaderText="COMMENT" SortExpression="COMMENT" />

</Columns>

<AlternatingRowStyle BackColor="#E0E0E0" Font-Names="Verdana" Font-Size="Small" />

</asp:GridView>

</ContentTemplate>

<Triggers>

<asp:AsyncPostBackTrigger ControlID="lnkbtnRefreshGrid" EventName="Click" />

</Triggers>

</asp:UpdatePanel>

<asp:ObjectDataSource ID="dsTransactions" runat="server" InsertMethod="Insert"

OldValuesParameterFormatString="original_{0}" SelectMethod="GetData" TypeName="budgetTableAdapters.TRANSACTIONSTableAdapter">

<SelectParameters>

<asp:ControlParameter ControlID="txtStartDate" Name="START_DATE"

PropertyName="Text" Type="DateTime" />

<asp:ControlParameter ControlID="txtEndDate" Name="END_DATE"

PropertyName="Text" Type="DateTime" />

</SelectParameters>

<InsertParameters>

<asp:Parameter Name="ACCOUNT_ID" Type="Int32" />

<asp:Parameter Name="TRANSACTION_DATE" Type="DateTime" />

<asp:Parameter Name="AMOUNT" Type="Double" />

<asp:Parameter Name="COMMENT" Type="String" />

<asp:Parameter Name="PAYEE_ID" Type="Int32" />

<asp:Parameter Name="PAY_BASIS" Type="Byte" />

<asp:Parameter Name="OFF_BUDGET" Type="Boolean" />

<asp:Parameter Name="DEDUCT_FROM_BA" Type="Boolean" />

</InsertParameters>

</asp:ObjectDataSource>

<br />

<br />

</ContentTemplate>

</ajaxToolkit:TabPanel>

</ajaxToolkit:TabContainer>

 

the code behind (the msgbox doesn't even fire)

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click

MsgBox(txtEndDate.Text)

grdTransactions.DataBind()

End Sub

Protected Sub lnkbtnRefreshGrid_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles lnkbtnRefreshGrid.Click

MsgBox(txtEndDate.Text)

grdTransactions.DataBind()

End Sub

You means

Ravenet Rasaiyah replied to Christopher Baker on 24-Apr-09 02:06 PM
Hi

You means you need Button on the Tab Header ? or in the Content place ?

there is a button and a link button on page

Christopher Baker replied to Ravenet Rasaiyah on 24-Apr-09 02:14 PM

content please


Lets try this way

Ravenet Rasaiyah replied to Christopher Baker on 24-Apr-09 02:19 PM
Hi
1. <asp:Button ID="Button1" runat="server" Text="Button" CausesValidation="false"  OnClick="Button1_Click" />

Because of its validating your form other control

thank you
you da man!
Christopher Baker replied to Ravenet Rasaiyah on 24-Apr-09 02:31 PM

works!

awesome!

I spent the last two days on this


thanks thanks thanks thanks


welcome buddy
Ravenet Rasaiyah replied to Christopher Baker on 24-Apr-09 02:32 PM
end of post