D
David C
I have an asp.net page that has a DropDownList that Controls the display of
a particular record in a FormView. It works fine except for when I add or
delete a record in the FormView then the DropDownList is not showing the new
selection and it retains the selection of the deleted record until I
completely leave the page and come back. I would like some help on what I
need to do/change to make this work. Page and code samples are below.
Thanks.
David
<aspropDownList ID="ddlTicklerID" runat="server" AutoPostBack="True"
DataSourceID="SqlvwTicklerPick" DataTextField="SubText"
DataValueField="TicklerID">
</aspropDownList>
DropDownList SqlDataSource is shown below.
<asp:SqlDataSource ID="SqlvwTicklerPick" runat="server"
ConnectionString="<%$ ConnectionStrings:FiledataConnectionString %>"
ProviderName="<%$
ConnectionStrings:FiledataConnectionString.ProviderName %>"
SelectCommand="SELECT [TicklerID], [SeqNo], [Subfile], [SubText]
FROM [vw_TicklerPick] WHERE ([FileNumber]=@txtFileNumber) ORDER BY [SeqNo]">
<SelectParameters>
<asp:ControlParameter ControlID="txtFileNumber"
PropertyName="Text" Type="Int32" Name="txtFileNumber" />
</SelectParameters>
</asp:SqlDataSource>
FormView SqlDataSource has the following parameters that link it to the
DropDown selection.
<SelectParameters>
<asp:ControlParameter ControlID="txtFileNumber"
PropertyName="Text" Type="Int32" Name="txtFileNumber" />
<asp:ControlParameter ControlID="ddlTicklerID"
PropertyName="SelectedValue" Type="Int32" Name="ddlTicklerID" />
</SelectParameters>
I have tried all of the events below to refresh the DropDownList but the
list is not changing.
Protected Sub SqlContractTicklerFile_Deleted(ByVal sender As Object,
ByVal e As System.Web.UI.WebControls.SqlDataSourceStatusEventArgs)
SqlvwTicklerPick.DataBind()
ddlTicklerID.DataBind()
End Sub
Protected Sub BtnDeleteTickler_Command(ByVal sender As Object, ByVal e
As System.Web.UI.WebControls.CommandEventArgs)
SqlvwTicklerPick.DataBind()
ddlTicklerID.DataBind()
End Sub
Protected Sub fvTickler_ItemUpdated(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.FormViewUpdatedEventArgs)
SqlvwTicklerPick.DataBind()
ddlTicklerID.DataBind()
fvTickler.DataBind()
End Sub
a particular record in a FormView. It works fine except for when I add or
delete a record in the FormView then the DropDownList is not showing the new
selection and it retains the selection of the deleted record until I
completely leave the page and come back. I would like some help on what I
need to do/change to make this work. Page and code samples are below.
Thanks.
David
<aspropDownList ID="ddlTicklerID" runat="server" AutoPostBack="True"
DataSourceID="SqlvwTicklerPick" DataTextField="SubText"
DataValueField="TicklerID">
</aspropDownList>
DropDownList SqlDataSource is shown below.
<asp:SqlDataSource ID="SqlvwTicklerPick" runat="server"
ConnectionString="<%$ ConnectionStrings:FiledataConnectionString %>"
ProviderName="<%$
ConnectionStrings:FiledataConnectionString.ProviderName %>"
SelectCommand="SELECT [TicklerID], [SeqNo], [Subfile], [SubText]
FROM [vw_TicklerPick] WHERE ([FileNumber]=@txtFileNumber) ORDER BY [SeqNo]">
<SelectParameters>
<asp:ControlParameter ControlID="txtFileNumber"
PropertyName="Text" Type="Int32" Name="txtFileNumber" />
</SelectParameters>
</asp:SqlDataSource>
FormView SqlDataSource has the following parameters that link it to the
DropDown selection.
<SelectParameters>
<asp:ControlParameter ControlID="txtFileNumber"
PropertyName="Text" Type="Int32" Name="txtFileNumber" />
<asp:ControlParameter ControlID="ddlTicklerID"
PropertyName="SelectedValue" Type="Int32" Name="ddlTicklerID" />
</SelectParameters>
I have tried all of the events below to refresh the DropDownList but the
list is not changing.
Protected Sub SqlContractTicklerFile_Deleted(ByVal sender As Object,
ByVal e As System.Web.UI.WebControls.SqlDataSourceStatusEventArgs)
SqlvwTicklerPick.DataBind()
ddlTicklerID.DataBind()
End Sub
Protected Sub BtnDeleteTickler_Command(ByVal sender As Object, ByVal e
As System.Web.UI.WebControls.CommandEventArgs)
SqlvwTicklerPick.DataBind()
ddlTicklerID.DataBind()
End Sub
Protected Sub fvTickler_ItemUpdated(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.FormViewUpdatedEventArgs)
SqlvwTicklerPick.DataBind()
ddlTicklerID.DataBind()
fvTickler.DataBind()
End Sub