なぜこれが難しいのかわかりませんが、フィールドにリンクされたはいいいえラジオボタンがあります。レコードが呼び出されたら、レコードの回答 (はいまたはいいえ) をラジオ ボタンで選択してください。私のコードは、ラジオ ボタンの ID を認識していません。どんな助けでも大歓迎です。以下はコードです。
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" %>
<script runat="server">
protected void frmProfiles_PageIndexChanging(object sender, FormViewPageEventArgs e)
{
RadioButton selectedRadioButton = (RadioButton)sender;
}
protected void onYesNochanged(object sender, EventArgs e)
{
if (rblYesNo.SelectedItem.Text == "yes")
;
else
;
}
</script>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2" Runat="Server">
<asp:FormView
id="frmProfiles"
DataSourceID="srcProfiles"
DataKeyNames="State"
Runat="server">
<ItemTemplate>
<h1>State: <%# Eval("State") %></h1>
<b>1. Is the SMHA Director/Commissioner a member of the Governor's Cabinet?</b>
<%#Eval("O_1") %>
<br />
<br />
<br />
<br />
<asp:LinkButton
id="lnkEdit"
Text="Edit State Information"
CommandName="Edit"
Runat="server" />
</ItemTemplate>
<EditItemTemplate>
<b>1. Is the SMHA Director/Commissioner a member of the Governor's Cabinet?</b>
<br />
<br />
<asp:Label
id="lblYesNo"
DataSourceID="srcProfiles"
DataKeyNames="State"
AssociatedControlID="rblYesNo"
Runat="server" >
<asp:RadioButtonList id="rblYesNo"
Runat="server"
enabled="true"
OnSelectedIndexChanged="onYesNochanged" >
<asp:ListItem Text="Yes" Value="Yes" />
<asp:ListItem Text="No" Value="No" />
</asp:RadioButtonList >
</asp:Label>
<br /><br />
|
<asp:LinkButton
id="lnkUpdate"
Text="Update State Information"
CommandName="Update"
Runat="server" />
|
<asp:LinkButton
id="lnkCancel"
Text="Cancel Update"
CommandName="Cancel"
Runat="server" />
</EditItemTemplate>
</asp:FormView>
<br />
Click on State Initials to go to next page.<br />
<asp:GridView
id="grdState"
DataSourceID="srcNext"
ShowHeader="false"
Runat="server">
<Columns>
<asp:HyperLinkField
DataTextField="State"
DataNavigateUrlFields="State"
DataNavigateUrlFormatString="Org2.aspx?State={0}" />
</Columns>
</asp:GridView>
<asp:AccessDataSource ID="srcProfiles"
SelectCommand="SELECT State, O_1 FROM [P13Organization]
WHERE State=AG"
UpdateCommand="UPDATE [P13Organization] SET State=@State, O_1=@O_1
WHERE State=@State"
DataFile="K:\3NRI\Profiles\Profiles.mdb"
runat="server">
<SelectParameters>
<asp:QueryStringParameter
Name="State"
QueryStringField="State" />
</SelectParameters>
</asp:AccessDataSource>
<asp:AccessDataSource ID="srcNext"
SelectCommand="SELECT State FROM [P13Organization]
WHERE State=@State"
DataFile="K:\3NRI\Profiles\Profiles.mdb"
runat="server">
<SelectParameters>
<asp:QueryStringParameter
Name="State"
QueryStringField="State" />
</SelectParameters>
</asp:AccessDataSource>
</asp:Content>