首页 > 解决方案 > 如何在gridview的TextBox中将字符串转换为DateTime

问题描述

protected void grvHerstellingen_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
    GridViewRow row = grvHerstellingen.Rows[e.RowIndex];
    int herstellingLijstIndex = row.DataItemIndex;
    int klantid = (int)grvHerstellingen.DataKeys[herstellingLijstIndex].Value;

    int nieuweToestelid = Convert.ToInt32((TextBox)row.Cells[1].Controls[0]);
    string nieuweDatumbinnen = ((TextBox)row.Cells[2].Controls[0]); 
    string nieuweDatumklaar = ((TextBox)row.Cells[3].Controls[0]);
    int nieuweKostprijs = Convert.ToInt32((TextBox) row.Cells[4].Controls[0]);

    _c.UpdateHerstelling(nieuweDatumbinnen, nieuweKostprijs, nieuweDatumklaar, nieuweToestelid, klantid);

    grvHerstellingen.EditIndex = -1;
    grvHerstellingen.DataSource = _c.GetAlleKlanten();
    grvHerstellingen.DataBind();
}

您好,我正在尝试将我的文本框的nieuweDatumbinnenand转换nieuweDatumklaar为 DateTime,但我还没有找到任何东西。有什么建议么?

标签: c#asp.net

解决方案


推荐阅读