触发SelectedIndexChanged事件ASP.NET

时间:2018-04-05 11:33:00

标签: asp.net gridview webforms dropdown selectedindexchanged

我在GridView中有一个DropDownList。我想在SelectedIndexChanged中对数据库进行一些更新,但是没有被触发。

PS:我尝试了我在互联网上找到的所有解决方案,但总是遇到同样的问题。

这是代码:

protected void grwConsent_RowDataBound(object sender, GridViewRowEventArgs e)
{
    if (e.Row.RowType == DataControlRowType.DataRow)
    {
        if (e.Row.Cells[0].Text != " ")
        {

            DropDownList ddlState = e.Row.FindControl("ddlState") as DropDownList;
            if (null != ddlState)
            {
                ddlState.Visible = true;
                string stateValue = (e.Row.FindControl("lblState") as Label).Text;

                ConsentHelper.LoadConsentStatesInList(ddlState,"-----",stateValue);

                ddlState.Items.RemoveAt(0);
                ddlState.Items.FindByText(stateValue).Selected = true;
            }
        }
    }

}

protected void ddlState_SelectedIndexChanged(object sender, EventArgs e)
{
    //Database Updates
}

背后的代码

                    <Dropzone onDrop={this.onDrop.bind(this)}
                              key={this.state.key}
                              style={{border: "none"}}>
                        <div className="input-file">
                            <label for="file">
                                <button type="button">Choisissez un fichier</button>
                            </label>
                        </div>
                        <div className={"file-name " + (!this.state.selectedOption ? '' : 'hidden')}>
                            Aucun fichier choisi
                        </div>
                        <div className={"file-name " + (this.state.selectedOption ? '' : 'hidden')}>
                            {this.state.selectedOption}
                        </div>
                    </Dropzone>

谢谢!

1 个答案:

答案 0 :(得分:0)

尝试将这些属性添加到DropDownList:

  • GROUP BY ... WITH ROLLUP
  • mysql> SELECT table_schema AS "Database name", SUM(ROUND(((DATA_LENGTH + INDEX_LENGTH) / 1024 / 1024 /1024 ), 2)) AS "Size (GB)" FROM information_schema.TABLES GROUP BY table_schema WITH ROLLUP;
  • ViewStateMode="Enabled"
EnableViewState="true"