ASP.NET AJAX ModalPopupExtender - opening with wrong button - asp.net

I am having trouble with the AJAX ModalPopupExtender control. What I am trying to do is click a button, trigger a postcode lookup using Yahoo API with the button click event, display this in an asp panel in the ShowModalDialog box, and then close the dialog. I also need a separate button on the page to submit information using a form that is completely separate from this.
I have set the target button up as follows:
<asp:Button ID="btnStockist" runat="server" BackColor="#2C3473" OnClick="btnStockist_Click" />
The modalpopup is as follows:
<ajax:ModalPopupExtender ID="mpeStockist" runat="server" okcontrolid="btnOkay" targetcontrolid="btnStockist" popupcontrolid="pnlDisplay"
popupdraghandlecontrolid="PopupHeader" drag="true" backgroundcssclass="ModalPopupBG" ></ajax:ModalPopupExtender>
What is actually happening is that when clicking the target button, the popup opens but the event does not trigger (no postcode lookup is done). However, clicking the separate, unrelated button on the same page DOES trigger the event, and the lookup works perfectly. I am able to close the dialog as normal. I have tried hiding the target button with CSS as a quick workaround, but the problem is that any other buttons on the page seem to trigger the lookup method and modalpopup no matter what their click event is programmed to do, and I need them to work separately.
In case it's of any use, the panel code is here:
<asp:Panel ID="pnlDisplay" style="display:none" runat="server">
<div class="PopupContainer">
<div class="PopupBody">
<div align="center">Local Suppliers</div>
<br /><br />
<asp:label ID="lblError" runat="server"></asp:label>
<asp:UpdatePanel ID="upAlternatives" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:DataList ID="dlStockist_Select" runat="server">
<HeaderTemplate>
<table cellpadding="5" width="680">
<tr>
<td>Name</td>
<td>Address</td>
<td>Town/City</td>
<td>Miles (Approx)</td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td><%# DataBinder.Eval(Container.DataItem, "CNAM") %></td>
<td><%# DataBinder.Eval(Container.DataItem, "CADD1") %></td>
<td><%# DataBinder.Eval(Container.DataItem, "CADD3")%></td>
<td align="center"><%# DataBinder.Eval(Container.DataItem, "Distance")%></td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:DataList>
</ContentTemplate>
</asp:UpdatePanel>
<asp:LinkButton ID="btnOkay" runat="server" visible="true" Text="Close" CommandName="Update" BorderColor="#FFFFFF" BackColor="#000000"
BorderWidth="3" BorderStyle="Double" ForeColor="White" Font-Size="13pt" style="cursor: pointer; padding: 1px 15px 1px 15px;
margin-top: 10px;" Font-Underline="False"></asp:LinkButton>
</div>
</div>
</asp:Panel>
Thanks in advance for the help

Add one more button as per below
<asp:Button Text="targetbutton" ID="tgtbtn" runat="server" Style="display: none" />
Set id of this button in targetcontrolid of modulpopup (because it can not be null)
and in click event of btnStockist
open your modulapopup by code
protected void btnStockist_Click(object sender, EventArgs e)
{
mpeStockist.Show();
}

Related

Set Focus not working in asp.net

I'm trying to set focus on a control after Postback but its not working. below are the details.
I have some code inside a Panel. Panel will be open closed using ajax.
There is a radio button inside panel ... Once I click the radio button, i want to focus on that control but it goes to start of the page due to post back.
I tried
1. SetFocus(controlID);
2. controlID.Focus();
3. set focus to control in javascript also
but no solution working.
This is a long page ... I have more panels in it. Not sure why my solutions are not working.
Attached my code below:
<Panel> first panel comes here...</Panel>
<div class="demoarea">
<asp:Panel ID="pnl_2_Header" runat="server" CssClass="collapsePanelHeader" Height="30px">
<div style="padding:5px; cursor: pointer; vertical-align: middle;">
<div style="float: left;">User's Information</div>
<div style="float: left; margin-left: 20px;">
<asp:Label ID="lbl_2_Header" runat="server" Visible="False">(Show Details...)</asp:Label>
</div>
<div style="float: right; vertical-align: middle;">
<asp:ImageButton ID="img_2_Header" runat="server" ImageUrl="~/images/expand_blue.jpg" AlternateText="(Show Details...)" Visible="False"/>
</div>
</div>
</asp:Panel>
<asp:Panel ID="pnl_2" runat="server" CssClass="collapsePanel" Height="0" BorderStyle="solid" BorderWidth="1">
<table width="100%" style="text-align:left;font-weight:300;" cellpadding="7">
<tr valign="top">
<td style="width:50%;">
School in Primary 6 :
<br /><br />
<asp:RadioButton ID="rdoPri1" runat="server"
Text="sometext" GroupName="pri" value="1"
AutoPostBack="True" oncheckedchanged="rdoPri1_CheckedChanged" /> <br />
<asp:RadioButton ID="rdoPriOther" runat="server" Text="Others"
GroupName="pri" value="2" AutoPostBack="True"
oncheckedchanged="rdoPriOther_CheckedChanged" />
<asp:TextBox ID="txtPriOther" CssClass="txt" Width="50%" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="reqPriOther" ValidationGroup="pnl_2" Visible="false" runat="server" ControlToValidate="txtPriOther" Text="*" ErrorMessage="*" SetFocusOnError="true"></asp:RequiredFieldValidator>
</td>
</tr>
</table>
</asp:Panel>
</div>
<ajaxToolkit:CollapsiblePanelExtender ID="cpe_2" runat="Server"
TargetControlID="pnl_2"
ExpandControlID="pnl_2_Header"
CollapseControlID="pnl_2_Header"
Collapsed="True"
TextLabelID="lbl_2_Header"
ImageControlID="img_2_Header"
ExpandedText="(Hide Details...)"
CollapsedText="(Show Details...)"
ExpandedImage="~/images/collapse_blue.jpg"
CollapsedImage="~/images/expand_blue.jpg"
SuppressPostBack="true"
SkinID="CollapsiblePanelDemo" />
<Panel> 3rd Panel </Panel>
...
Code behind:
protected void rdoPri1_CheckedChanged(object sender, EventArgs e)
{
-- Some code here --
//SetFocus(pnl_2);
rdoPri1.Focus();
}
Web form server control event will trigger postback when Autopostback is set to true. It means your Set focus will not be working expected after one of the controls triggered postback.
So, my personal opinion, it you need such a UI/UX design, I would suggest to use client script instead.
Add the same control.Focus() or setfocus in page load, and add conditions like if needed
//in page load
if (rdoButton1.Checked) {//setfocus here}

Change text of button inside listview

Sample ImageI have a listview in which a div has an image, a wishlist button and a add to cart button. When i click on wishlist the text does not change in listview_itemcode event. Below is code;
<asp:ListView ID="usrListShowImages" runat="server" OnItemCommand="usrListShowImages_ItemCommand">
<LayoutTemplate>
<table id="MainTablePlaceHolder" style="border:20px Orange; width:100%;" >
<tr style="border:5px orange;">
</tr>
<tr runat="server" id="itemPlaceHolder" style="border:2px Orange" />
</table>
</LayoutTemplate>
<ItemTemplate>
<tr>
<asp:UpdatePanel runat="server" UpdateMode="Conditional" ChildrenAsTriggers="false">
<ContentTemplate>
<asp:HyperLink ID="hypLink" NavigateUrl="http://www.google.com" runat="server" >
<div class="wishlist">
<div class="growuser picUserShow">
<asp:Image ID="userShowImgz" ClientIDMode="Static"
ImageUrl='<%# ".." + Eval("ItemsPicUrl") %>' runat="server" />
</asp:HyperLink>
<div class="bottomDiv">
<asp:Button ID="btnWhishlist" Text="Wishlist" runat="server" CssClass="wishlistButton" CommandName="btnWhishlist" UseSubmitBehavior="false" />
</div>
</div>
</div>
<%-- <asp:Label ID="lblShow" runat="server" Text="Label"></asp:Label>--%>
</ContentTemplate>
</asp:UpdatePanel>
</tr>
</ItemTemplate>
Any help would be highly appreciated
Couldn't understand the question, but your tags are little messy and it might be crossing with the lines of the update panels. you should use table-tr-td-/td-/tr-/table in the correct order to create a proper HTML table.
There are two ways of changing text when button (control) is inside a listview (another control).
listview_ItemCommand event in code behind.
protected void usrListShowImages_ItemCommand(object sender, ListViewCommandEventArgs e)
{
if (e.CommandName == "btnWhishlist")
{
if (e.Item.ItemType == ListViewItemType.DataItem)
{
Button dbutton = (Button)e.Item.FindControl("btnWhishlist");
if (dbutton.Text == "Wishlist")
{
dbutton.Text = "NEW";
}
lblTest.Text = dbutton.ID.ToString() + "text = " + dbutton.Text;
}
}
}
If the text doesn't appear changed, in .aspx page, just put the button (Control) inside UpdatePanel.
JQuery
jQuery: Change button text on click
This post will also help.

how to stop refreshing of current page when any server side event of web user control being fired

I'm building a web user control.
Now i need to fire some server side events on web user control.
And also need to stop page refreshing.
Can any one tell me how can i fire server side event on web user control without refreshing hole page.
Edit-1
My control (.ascx)
<%--Control designer start--%>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div style="position:relative;border:none;" id="divComboContainer" runat="server" >
<%--Hidden fields for datacombo values--%>
<asp:HiddenField ID="Hidden_Value" Value="" runat="server" />
<asp:HiddenField ID="Hidden_SorDir" Value="" runat="server" />
<asp:HiddenField ID="Hidden_RowIndex" Value="" runat="server" />
<asp:HiddenField ID="hfScrollPosition" Value="" runat="server" />
<%--Seleted text display textbox--%>
<asp:TextBox ID="txtDisplay" runat="server" CssClass="tb10" autocomplete="off" ToolTip="Type for search"></asp:TextBox>
<%--Panal and controls for dropdown--%>
<asp:Panel ID="DropPanel" runat="server" CssClass="ContextMenuPanel" Width="1000px"
style="display :none;
visibility: hidden;
border:2px solid #E5E5E5;
padding-bottom:-1px;
margin-top:-28px;
background-color:#83ACF3;
overflow:hidden;
height:auto;
max-height:700px;
max-width:1000px;">
<%--<asp:Button ID="Button1" runat="server" Text="Button" />--%>
<%--Search textbox div--%>
<div class="ddeSerch">
<div style="padding-top:5px;float:left;">
Look-Up
</div>
<asp:TextBox runat="server" ID="txtSearch" autocomplete="off" CssClass="tb10" BackColor="White" Width="50%" MaxLength="150"
onclick="return false;"
style="background: url(GridViewCSSThemes/Images/tia.png) no-repeat top right;background-color:White;padding-right:25px;">
</asp:TextBox>
<div style="padding-top:5px;float:right;cursor:pointer;" runat="server" id="dcmbClose" >
Close
</div>
</div>
<%--Datacombo header--%>
<asp:Table ID="Table1" runat="server" CssClass="header" GridLines="Vertical" Width="100%">
</asp:Table>
<%--Datacombo body(records)--%>
<div id="divGrid" runat="server" style="max-height:615px;width:100%;overflow-X:auto;overflow-Y:auto;">
<asp:GridView ID="gridEdit" GridLines="Vertical" runat="server" Width="100%"
ShowFooter="false" AutoGenerateColumns="false" ShowHeader="false" AllowSorting="true"
Font-Size = "11pt" Font-Names = "Arial" style="color:Black;"
AlternatingRowStyle-BackColor="#CCDDFB"
RowStyle-BackColor="WhiteSmoke"
OnRowCreated="gridEdit_RowCreated" OnRowDataBound="gridEdit_RowDataBound" OnSorting="gridEdit_Sorting">
<HeaderStyle HorizontalAlign="Left" CssClass="header" Font-Bold="false" />
<RowStyle CssClass="rowstyle"/>
<Columns>
</Columns>
</asp:GridView>
</div>
<%--Datacombo footer--%>
<table class="footer" id="tblfooter" runat="server">
<tr>
<td style="text-align:left;">
<asp:TextBox Enabled="false" autocomplete="off" ID="lblOrd" CssClass="footer" runat="server" Width="100%"></asp:TextBox>
</td>
<td style="text-align:right;">
<asp:TextBox Enabled="false" autocomplete="off" ID="lblTot" CssClass="footer" style="text-align:right;" runat="server" Width="100%"></asp:TextBox>
</td>
</tr>
</table>
</asp:Panel>
<ajaxToolkit:DropDownExtender runat="server" ID="DDE"
TargetControlID="txtDisplay"
DropDownControlID="DropPanel" HighlightBorderColor="Transparent">
</ajaxToolkit:DropDownExtender>
</div>
</ContentTemplate>
</asp:UpdatePanel>
Use on aspx page
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<uc1:UCDataCombo runat="server" ID="UCDataCombo4"/>
</ContentTemplate>
</asp:UpdatePanel>
When user clicks on header of gridview it fires some events.
And hole page got refreshed.
I need to stop refreshing of hole page.
UpdatePanel enables sections of a page to be partially rendered without a postback.
You can have a full understanding by reading here.
-EDIT-
I don't if this will help but you gotta try this:
Check if is set in your web.config, if it is there you may want to remove it.
Go to this link for more details.
Hope it helps!
Problem i solved by setting clientIDMode to Static.
clientIDMode="Static".
Now update panel works fine.

Using DataList control to redirect user on other page and fetch data on that page depending on the button clicked in previous page

I am using a datalist control in which i have a div and some other asp controls.
I have an edit button in it. If I click on edit button, I want to redirect user to another page on which I have some controls and I want information to be filled up in those controls depending upon the button I have clicked in previous page.
Here is the datalist code:
<asp:DataList ID="DataList1" runat="server" DataKeyField="ID" RepeatColumns="2" RepeatDirection="Horizontal" RepeatLayout="Table">
<ItemTemplate>
<div><br /><br /><br />
<div style="background-color:Silver;height: auto; display:block;" >
<div id="threadPostLeftDiv" style="width:auto; border-style:solid; border-width:2px; border-color:Black;border-right-color:White;" >
<asp:Image runat="server" ID="ImagePreview1" style="margin-right:5px; " ImageUrl='<%# Eval("imageurl") %>' Height="100px" Width="100px" BorderStyle="None" />
</div>
<div id="threadPostRightDiv" style=" border-style:solid; border-width:2px;margin-left:-15px; border-color:Black;border-left-color:White;">
<asp:Label ID="txtHeadline1" CssClass="inputprev" style=" font-size:medium; font-weight:bolder;" Text='<%# Eval("subtitle") %>' Enabled="false"
placeholder="Headline" runat="server"></asp:Label>
<br />
<asp:Textbox ID="txtDescription1" CssClass="inputprevdesc1" Text='<%# Eval("descriptions") %>'
Enabled="false" BackColor="Silver" Rows="3" TextMode="MultiLine" placeholder="Description" runat="server"></asp:Textbox><br />
<br />
<asp:Label ID="txtOfferHeadline1" Text='<%# Eval("title") %>' Enabled="false" CssClass="inputprev1"
placeholder="Offer Headline" runat="server"></asp:Label>
<br />
</div>
</div>
<div style=" float: right;margin-right:10px; ">
<button id="btnEdit" class="css3button1" onserverclick="btnEdit_Click" runat="server">Edit</button>
</div>
</div>
</asp:DataList>
Please help me in acheiving my goal,give me the code behind file and what events to triggers.
Thank you.
Well that can be easily achived by doing the following things
bind 'btnEdit' commandargument with the id
<button id="btnEdit" class="css3button1" onserverclick="btnEdit_Click" runat="server" CommandArgument='<%# Eval("ID") %>' >Edit</button>
in btnEdit_Click event do the following
Button bt = (Button)sender;
string recordid = bt.CommandArgument;
Response.Redirect("editrecordno.aspx?recordid="+recordid,true);
in editrecordno.aspx page request the querystring and do the need full.
in Button_Click event you shoul redirect to another page with QueryString paramater
Replace your edit <button> with this code line
<asp:Button ID="Button1" PostBackUrl='DataEdit.aspx?id=<%# Eval("id") %>' runat="server" Text="Edit" />
In DataEdit.aspx put your FormView with DefaultMode=Edit
Then Add new QueryString Parameter in your DataSource
I converted html button to link button and fired onRowCOmmand event and I got my solution.

GridView destroy tab order

I have a user control that has two dropdownlists, four textboxes and a gridview in said order. I want the focus to move in this order as tab key is pressed.
I have tabindex property of each control set in sequence (1005, 1010, 1015 ...) except the gridview whose tabindex property is not set to anything.
At page_load I am setting focus to the first dropdownlist.
When page is loaded, focus is on the first dropdownlist, as desired. Then when tab is pressed focus moves to the next dropdownlist, as desired. The problem is when the tab is pressed at this stage, now instead of moving to the first textbox (which has tabindex set to 1015), the focus is moved on the gridview. Note that the gridview do not have its tabindex set to anything. When tab is pressed now, the focus is moved on other user controls on the page, that is, totally out of the discussed user control. Then after several key presses user control do come back to the user control and then move in desired order, that is, first dropdownlist, then second dropdownlist, then first textbox, then second textbox, then third textbox, then fourth textbox. After this it skip the gridview altogether and move to controls which are at the master page.
So, when page is loaded, tab is moving in a different order than what it do once cycle of tabs is completed, that is, all controls are focused.
If I move focus to the first textbox by using mouse click, then press tab then focus is moved to the second textbox as desired, then to third textbox as desired, then to fourth textbox as desired.
I am using two user controls in the page, one of which is discussed above, plus a control directly on page. There are some controls in master page too.
No server or client side event handling happens when tab key is being pressed.
I have tried replace html input control with asp.net textbox control but problem remains.
Request: Please prefer a simple solution, that is one that do not require manually setting tabindex in code-behind because that is not very scalable.
<%# Control Language="C#" AutoEventWireup="true" CodeBehind="GridExpense.ascx.cs" Inherits="StationaryManagementSystem.GridExpense" %>
<%# Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<script type="text/javascript">
function MinQuantity_Blurred()
{
$('#' + '<%= hitMaxQuantitySearch.ClientID %>')[0].value = $('#' + '<%= hitMinQuantitySearch.ClientID %>')[0].value;
}
function FromDated_Blurred()
{
$('#' + '<%= txtToDatedSearch.ClientID %>')[0].value = $('#' + '<%= txtFromDatedSearch.ClientID %>')[0].value;
}
</script>
<asp:Panel ID="panel" runat="server">
<table>
<tr>
<td>
<table width="800px">
<tr align="right">
<td class="columnOne">
Item :
</td>
<td class="columnTwo">
<asp:DropDownList ID="ddlItemSearch" runat="server" EnableViewState="true" DataValueField="Id" DataTextField="Name" TabIndex="1005" Width="200px" />
</td>
<td class="columnOne">
Officer :
</td>
<td class="columnTwo">
<asp:DropDownList ID="ddlOfficerSearch" runat="server" EnableViewState="true" DataValueField="Id" DataTextField="Name" TabIndex="1010" Width="200px" />
</td>
</tr>
<tr align="right">
<td align="right" style="width:200px">
From Quantity:
</td>
<td align="left">
<input type="text" id="hitMinQuantitySearch" name="hitMinQuantitySearch" runat="server" maxlength="9" tabindex="1015"
style="width: 90px; text-align: right" onkeydown="return isNumericKeyDown(event, false);" onkeypress="return isNumericKeyPress(event, false);"
onblur="MinQuantity_Blurred();" />
</td>
<td align="right" style="width:200px">
To Quantity:
</td>
<td align="left">
<input type="text" id="hitMaxQuantitySearch" name="hitMaxQuantitySearch" runat="server" maxlength="9" tabindex="1020"
style="width: 90px; text-align: right" onkeydown="return isNumericKeyDown(event, false);" onkeypress="return isNumericKeyPress(event, false);" />
</td>
</tr>
<tr align="right">
<td class="columnOne">
From Dated :
</td>
<td class="columnTwo">
<asp:TextBox ID="txtFromDatedSearch" runat="server" MaxLength="11" TabIndex="1025" onblur="FromDated_Blurred();" Width="90px" />
<asp:CalendarExtender ID="ceFromDatedSearch" runat="server" TargetControlID="txtFromDatedSearch" Format="dd-MMM-yyyy" />
</td>
<td class="columnOne">
To Dated :
</td>
<td class="columnTwo">
<asp:TextBox ID="txtToDatedSearch" runat="server" MaxLength="11" TabIndex="1030" Width="90px" />
<asp:CalendarExtender ID="ceToDatedSearch" runat="server" TargetControlID="txtToDatedSearch" Format="dd-MMM-yyyy" />
</td>
<td align="left">
<asp:Button ID="btnLoad" runat="server" Text="Load" TabIndex="1035" CssClass="foreRed gradientGreen cornerRound" OnClick="btnLoad_Click" />
</td>
</>
</table>
</td>
</tr>
<tr>
<td>
<asp:GridView ID="gv" runat="server" AutoGenerateColumns="False" DataSourceID="ods" AllowSorting="True" AllowPaging="True" PageSize="5"
AutoGenerateSelectButton="True" onrowcommand="gv_RowCommand" CssClass="gridSapphire" PagerStyle-CssClass="pagerSapphire"
AlternatingRowStyle-CssClass="alterSapphire" onpageindexchanged="gv_PageIndexChanged" Width="100%" EmptyDataText="List is empty."
DataKeyNames="Id" EnableViewState="true" onrowdeleted="gv_RowDeleted">
<PagerSettings Mode="Numeric"/>
<Columns>
<asp:TemplateField Visible="false">
<ItemTemplate>
<asp:Label ID="lblIdGrid" runat="server" Text='<%#Eval("Id") %>'/>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField Visible="false">
<ItemTemplate>
<asp:Label ID="lblIdItemGrid" runat="server" Text='<%#Eval("IdItem") %>' Style="text-align:left; padding-left:5px" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Item" SortExpression="NameItem" ControlStyle-Width="260px">
<ItemTemplate>
<asp:Label ID="lblNameItemGrid" runat="server" Text='<%#Eval("NameItem") %>' Style="text-align:left; padding-left:5px" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField Visible="false">
<ItemTemplate>
<asp:Label ID="lblIdOfficerGrid" runat="server" Text='<%#Eval("IdOfficer") %>' Style="text-align:left; padding-left:5px" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Officer" SortExpression="NameOfficer" ControlStyle-Width="200px">
<ItemTemplate>
<asp:Label ID="lblNameOfficerGrid" runat="server" Text='<%#Eval("NameOfficer") %>' Style="text-align:left; padding-left:5px" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Quantity" SortExpression="Quantity" ControlStyle-Width="100px">
<ItemTemplate>
<asp:Label ID="lblQuantityGrid" runat="server" Text='<%#Eval("Quantity") %>' Style="text-align:left; padding-left:5px" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Dated" SortExpression="Dated" ControlStyle-Width="100px">
<ItemTemplate>
<asp:Label ID="lblDatedGrid" runat="server" Text='<%# DateTime.Parse(Eval("Dated").ToString()).ToString("dd-MMM-yyyy") %>'
Style="text-align:left; padding-left:5px" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:LinkButton ID="lbDeleteGrid" runat="server" CommandName="Delete" OnClientClick="return confirm('Are you sure you want to delete this Expense?')">
Delete
</asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<PagerStyle CssClass="pagerSapphire" />
<AlternatingRowStyle CssClass="alterSapphire" />
</asp:GridView>
<asp:ObjectDataSource ID="ods" runat="server" TypeName="StationaryManagementSystem.Classes.DAL.Expense"
SelectMethod="Search" SelectCountMethod="CountSearch" SortParameterName="sSortExpression" EnablePaging="true"
StartRowIndexParameterName="iZeroIndexStartPage" MaximumRowsParameterName="iSizePage"
onselecting="ods_Selecting"
DeleteMethod="Delete" ondeleting="ods_Deleting">
<DeleteParameters>
<asp:Parameter Name="ID" Type="Int64" />
</DeleteParameters>
</asp:ObjectDataSource>
</td>
</tr>
</table>
</asp:Panel>
The problem is not with GridView but with a javascript library select2 that I been using but not showed above. Once this is removed the tab ordering is working almost as desired.
Some problem remains. Now the tab moves correctly through the six controls: the two dropdownlists and the four textboxes, but after that do not go to the gridview. Setting tabindex on gridview do not solve this problem.
Since problem turns out to be different than discussed in this post, I have a separate question for that here.
As said above, some of the problem discussed here still remains. Can anybody tell what is the default tabindex of controls inside a gridview if tabindex of gridview is not set. Tab do work in correct sequence once the gridview get the focus but its very hard to move focus to the grid itself. Actually focus can be moved to the grid by gridview.Focus(); but this do not move focus to the first element inside the gridview. Therefore when tab is pressed next focus moves outside the gridview altogether.

Resources