0

私はこれを理解するのに苦労しています。私はそれをうまく説明できないので、最初にいくつかのhtml/aspをここに示します:

<%for(int i=0; i<getCountRows(); i++)
    {
        setLabelsFestivals(i);
%>
    <form action="festival_details.aspx" method="post">
        <table id="table_600px_border">
            <tbody class="content_table_left" style='padding: 10px;'>
                <tr>
                    <td class="content_table_300px content_table_left_up">
                        <div class="text_bold">
                            <asp:Label ID="nameFestival" runat="server"></asp:Label>
                        </div>
                        <asp:HiddenField ID="fest_id" runat="server" />
                    </td>
                    <td class="content_table_300px content_table_left_up_bottom">
                        <asp:Label ID="startDateFestival" runat="server"></asp:Label>
                    </td>
                </tr>
                <tr>
                    <td class="content_table_left_up">
                        <asp:Label ID="locationFestival" runat="server"></asp:Label>
                    </td>
                    <td class="content_table_left_up">
                        <asp:Label ID="endDateFestival" runat="server"></asp:Label>
                    </td>
                </tr>
                <tr>
                    <td class="content_table_left_up_bottom">
                        <asp:HyperLink ID="urlFestival" runat="server">Site</asp:HyperLink>
                    </td>
                    <td class="content_table_right_bottom">
                    <input type="submit" name="btnDetails" value="Details" />
                    </td>
                </tr>
            </tbody>
        </table>
    </form>
<% }

データセットの行ごとに、単純な送信ボタンを備えたフォームが動的に作成されます。これがコードビハインドで起こることです

//This method makes sure that the correct labels are shown on the screen
protected void setLabelsFestivals(int positionDataSet)
{
    //Checking if data is found for bands
    if (getCountRows() > 0)
    {
        DateTime dtStartDate = Convert.ToDateTime(dataSetFestivals.Tables[0].Rows[positionDataSet]["fest_datum"].ToString());
        DateTime dtEndDate = Convert.ToDateTime(dataSetFestivals.Tables[0].Rows[positionDataSet]["fest_einddatum"].ToString());

        //Showing all festivals and its data
        nameFestival.Text = dataSetFestivals.Tables[0].Rows[positionDataSet]["fest_naam"].ToString();
        fest_id.Value = dataSetFestivals.Tables[0].Rows[positionDataSet]["fest_id"].ToString();
        startDateFestival.Text = "Begindatum: " + dtStartDate.ToString("yyyy-MM-dd");
        locationFestival.Text = "Locatie: " + dataSetFestivals.Tables[0].Rows[positionDataSet]["fest_locatie"].ToString();
        endDateFestival.Text = "Einddatum: " + dtEndDate.ToString("yyyy-MM-dd");
        urlFestival.NavigateUrl = "http://" + dataSetFestivals.Tables[0].Rows[positionDataSet]["fest_url"].ToString();
        urlFestival.Target = "_blank";
    }
}

では、たとえば、festival_details.aspx の隠しフィールド幅 ID「fest_id」の値を取得するにはどうすればよいでしょうか? これは私が試したものです:

HttpContext variables = HttpContext.Current;
strFormIdFest = variables.Request["fest_id"];

ただし、String strFormIdFest は常に null です。clientId と何か関係があると思いますか?

4

1 に答える 1