What do you mean the layout is changed? That is a different question from your title, which is about focus being lost.
You have only shown us a snippet of code. It appears you are using a Multiview control, and we have no idea what other views you have, or what code you have wired up to transition between views.
I can't reproduce your error , please provide your code behind event and explain more . General we can set the ActioViewIndex which is used to get an Index of your View. Please try to use :
MultiView1.ActiveViewIndex = YourIndex;
For exmaple , your current view is in the second one of MultiView , then set ActiveViewIndex to 1.
Use the SetActiveView method in your dropdown function. Since I don't know the id of your Multiview (you aren't showing all your markup/code), I can't tell you exactly what to use, but it will be
Member
28 Points
51 Posts
Why fired OnSelectedIndexChanged event, it is lost focus?
Jun 13, 2018 02:30 AM|fsze88|LINK
Hi,
I want to solve, after OnSelectedIndexChanged DDLoEonChange fired, the layout is changed?
<asp:View ID="LoEAdmin" runat="server">
<form id="LoEAdminForm" >
<table>
<tr>
<td>LoEAdminForm</td>
<td colspan="2">
<asp:DropDownList id="DDLoESelect" runat="server" AutoPostBack="True" OnSelectedIndexChanged="DDLoEonChange" ></asp:DropDownList>
<select id="LoESelect" name="LoESelect" runat="server" >
</select>
</td>
</tr>
<tr>
<td>Description : </td><td><input id="LoEDescription" type="text" name="LoEDescription" runat="server" /></td>
<td><asp:RequiredFieldValidator runat="server" ID="rLoEDescription" ControlToValidate="LoEDescription" ErrorMessage="LoEDescription file is empty"></asp:RequiredFieldValidator></td>
</tr>
<tr>
<td>Remarks : </td><td><input id="LoERemarks" type="text" name="LoERemarks" runat="server" /></td><td><asp:RequiredFieldValidator runat="server" ID="rLoERemarks" ControlToValidate="LoERemarks" ErrorMessage="LoERemarks file is empty"></asp:RequiredFieldValidator></td>
</tr>
<tr>
<td>Clean Version : </td><td><asp:FileUpload ID="LoEClean_Version" runat="server" /></td><td><asp:RequiredFieldValidator runat="server" ID="rLoEClean_Version" ControlToValidate="LoEClean_Version" ErrorMessage="LoEClean_Version file is empty"></asp:RequiredFieldValidator></td>
</tr>
<tr><td>Track Change : </td><td><asp:FileUpload ID="LoETrack_Change" runat="server" /></td><td><asp:RequiredFieldValidator runat="server" ID="rLoETrack_Change" ControlToValidate="LoETrack_Change" ErrorMessage="LoETrack_Change file is empty"></asp:RequiredFieldValidator></td>
</tr>
<tr><td colspan="3"><asp:Button ID="btnLoEUpload" runat="server" Text="Upload" OnClick="UploadLoEAction" /></td></tr>
</table>
</form>
</asp:View>
Thanks
Francis SZE
Contributor
5921 Points
2448 Posts
Re: Why fired OnSelectedIndexChanged event, it is lost focus?
Jun 13, 2018 05:17 AM|KathyW|LINK
What do you mean the layout is changed? That is a different question from your title, which is about focus being lost.
You have only shown us a snippet of code. It appears you are using a Multiview control, and we have no idea what other views you have, or what code you have wired up to transition between views.
Member
28 Points
51 Posts
Re: Why fired OnSelectedIndexChanged event, it is lost focus?
Jun 13, 2018 06:14 AM|fsze88|LINK
on DroptDownList after SelectedIndexChanged event fired and call void DDLoEonChange
<asp:DropDownList id="DDLoESelect" runat="server" AutoPostBack="True" OnSelectedIndexChanged="DDLoEonChange" ></asp:DropDownList>
the web page become blank
Contributor
2195 Points
950 Posts
Re: Why fired OnSelectedIndexChanged event, it is lost focus?
Jun 13, 2018 06:49 AM|jimmy69|LINK
Hello all,
Ok course it's a post back because the dropdownlist has autpostback true => when you change a value inside the ENTIRE page is REFRESH ...
what do you want to do exactly ? if you don't want to refresh the entire page :
tell us what do you need exactly ?
Member
28 Points
51 Posts
Re: Why fired OnSelectedIndexChanged event, it is lost focus?
Jun 13, 2018 07:06 AM|fsze88|LINK
a way to go back the view after run DDLoEonChange function?
<asp:View ID="LoEAdmin" runat="server">
<form id="LoEAdminForm" >
<table>
<tr>
<td>LoEAdminForm</td>
<td colspan="2">
<asp:DropDownList id="DDLoESelect" runat="server" AutoPostBack="True" OnSelectedIndexChanged="DDLoEonChange" ></asp:DropDownList>
<select id="LoESelect" name="LoESelect" runat="server" >
</select>
</td>
</tr>
<tr>
<td>Description : </td><td><input id="LoEDescription" type="text" name="LoEDescription" runat="server" /></td>
<td><asp:RequiredFieldValidator runat="server" ID="rLoEDescription" ControlToValidate="LoEDescription" ErrorMessage="LoEDescription file is empty"></asp:RequiredFieldValidator></td>
</tr>
<tr>
<td>Remarks : </td><td><input id="LoERemarks" type="text" name="LoERemarks" runat="server" /></td><td><asp:RequiredFieldValidator runat="server" ID="rLoERemarks" ControlToValidate="LoERemarks" ErrorMessage="LoERemarks file is empty"></asp:RequiredFieldValidator></td>
</tr>
<tr>
<td>Clean Version : </td><td><asp:FileUpload ID="LoEClean_Version" runat="server" /></td><td><asp:RequiredFieldValidator runat="server" ID="rLoEClean_Version" ControlToValidate="LoEClean_Version" ErrorMessage="LoEClean_Version file is empty"></asp:RequiredFieldValidator></td>
</tr>
<tr><td>Track Change : </td><td><asp:FileUpload ID="LoETrack_Change" runat="server" /></td><td><asp:RequiredFieldValidator runat="server" ID="rLoETrack_Change" ControlToValidate="LoETrack_Change" ErrorMessage="LoETrack_Change file is empty"></asp:RequiredFieldValidator></td>
</tr>
<tr><td colspan="3"><asp:Button ID="btnLoEUpload" runat="server" Text="Upload" OnClick="UploadLoEAction" /></td></tr>
</table>
</form>
</asp:View>
All-Star
18815 Points
3831 Posts
Re: Why fired OnSelectedIndexChanged event, it is lost focus?
Jun 13, 2018 07:38 AM|Nan Yu|LINK
Hi fsze88,
I can't reproduce your error , please provide your code behind event and explain more . General we can set the ActioViewIndex which is used to get an Index of your View. Please try to use :
For exmaple , your current view is in the second one of MultiView , then set ActiveViewIndex to 1.
Best Regards,
Nan Yu
Contributor
5921 Points
2448 Posts
Re: Why fired OnSelectedIndexChanged event, it is lost focus?
Jun 13, 2018 07:38 AM|KathyW|LINK
Use the SetActiveView method in your dropdown function. Since I don't know the id of your Multiview (you aren't showing all your markup/code), I can't tell you exactly what to use, but it will be
YourMultiViewID.SetActiveView(LoEAdmin);