问题描述
大家好,
我有一个包含几列的SQL表:
I have a SQL table with several columns:
id,DataIn,DataInDate等...
id, DataIn, DataInDate, etc...
我有一个带有dataGrid的网页,这些列可见,这些列已转换为Template,以便可以将RadioButtonList分配给EditItemTemplate.
I have a webpage with a dataGrid on with these columns visible which have been converted to a Template so that I can assign a RadioButtonList to the EditItemTemplate.
(DataIn是一个RadioButtonList,具有两个选项-否和是)
(DataIn is a RadioButtonList with two options - No and Yes)
当前,当创建新记录时,DataIn在表级别而不是代码中的默认值为'No'.
Currently, when a new record is created the DataIn has a default value of 'No' at the table level and not in the code.
当用户通过RadioButtonList将其值更新为是"时,我希望DataInDate值成为当前的日期和时间.
When a user Updates this value to 'Yes', via the RadioButtonList, I want the DataInDate value to become the current Date and Time.
这是我当前的代码:
protected void LinkButton1_Click(object sender, EventArgs e) { if(RadioButtonList = "yes") { //do if yes } else { //do something else } } }
LinkButton1_Click是gridview中的 更新 链接.
The LinkButton1_Click is the update link in the gridview.
我不确定If语句是否确实需要,但是我想听听任何人对它如何工作的想法.
I am unsure of the If statement, if in fact that is what I need, but wanted to hear anyone's thoughts on how this would work.
李·沃伦
推荐答案
这篇关于C#If语句在更新时更改记录值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!