?
Solved

Dropdown change cause gridview to loose data and selected index change doesn't fire

Posted on 2009-07-11
2
Medium Priority
?
688 Views
Last Modified: 2012-05-07
I changed the selection from my dropdown:
my selectedindex change does not get fired.
first time it keeps my selection on the gridview.
if i change dropdown again i loose selection and it resets my dropdown.
part of data does not get set on my gridview.


usercontrol 1 =========================================================
pageload
if not ispostback then
MainGridView.datasource = ds
MainGridView.databind()
end if
 
code:
If e.Row.RowType = DataControlRowType.DataRow Then 
 Dim myrow As GridViewRow = e.Row
 
                        If e.Row.RowIndex = 0 Then
                            Dim ucg As UCGridview
                            ucg = CType(myrow.FindControl("Details"), UCGridview)
 
                            Dim detgridview As GridView = CType(ucg .FindControl("detailsGridview"), GridView)
                            detgridview .DataSource = ds
                            detgridview .DataKeyNames = New String() {"ID"}
                            detgridview .DataBind()
                          End If
end if
markup
<asp:GridView ID="MainGridView" runat="server" AutoGenerateColumns="false" EnableViewState="true">
                    <Columns>
                        <asp:TemplateField ItemStyle-VerticalAlign="Top" HeaderText="MainHeading">
                            <ItemTemplate>
                                <uc:DetailsID="Details" runat="server" />
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                </asp:GridView>
 
UCGridview =====================================================================
markup part:
<asp:TemplateField ItemStyle-VerticalAlign="Top" HeaderText="Products" Visible="True">
            <ItemTemplate>
            <asp:UpdatePanel runat="server" ID="ProductsDropDownListUpdatePanels" UpdateMode="Conditional">
                <ContentTemplate>
                <asp:DropDownList ID="Products" runat="server" EnableViewState="true" AppendDataBoundItems="true"
                    AutoPostBack="true">
                    <asp:ListItem Text="1">1</asp:ListItem>
                    <asp:ListItem Text="2">2</asp:ListItem>
                   </asp:DropDownList>
                </ContentTemplate>
            </asp:UpdatePanel>
                
            </ItemTemplate>
        </asp:TemplateField>
Code:
    Private Sub ProductsDropDownList_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs) Handles ProductsDropDownList.SelectedIndexChanged
 
    End Sub

Open in new window

0
Comment
Question by:Padre_Corleone
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 15

Expert Comment

by:jinal
ID: 24830084
Hello ,

In order to SelectedIndexChanged fired need to set AutoPostBack = true for DropDownList. Please set that and test.
0
 
LVL 7

Accepted Solution

by:
Padre_Corleone earned 0 total points
ID: 24856599
the issue was that every dropdown change, i was reloading this User control.  avoiding reloading of control also avoided that not firing event. thanks!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question