我正在“ Create.cshtml”视图中工作。我正在尝试使用存储在ViewBag
中的值来创建一个不可编辑的表单控件,并使用该值来设置。像这样:
@Html.Textbox(
*model attribute*,
*default value ie. (ViewBag.ID)*,
htmlAttributes: new { @class = "form-control" @readonly="readonly" }
)
我无法弄清楚正确的语法甚至我应该使用哪种控件。这是该控件的工作版本,但没有预设值且可编辑。
@using (Html.BeginForm())
{
@Html.AntiForgeryToken()
<div class ="form-horizontal">
<div class="form-group">
@Html.EditorFor(model => model.LeagueID, new { htmlAttributes = new { @class = "form-control" } })
</div>
</div>
}
答案 0 :(得分:0)
您应该尝试:
import gspread
from oauth2client.service_account import ServiceAccountCredentials
scope = ["https://spreadsheets.google.com/feeds","https://www.googleapis.com/auth/drive"]
creds = ServiceAccountCredentials.from_json_keyfile_name('client_secret.json', scope)
client = gspread.authorize(creds)
sheet = client.open('Note Card BS').sheet1
for i in range(2, 22):
while sheet.cell(2, i).value=="":
source = input("What is source "+str(i-1)+"?: ")
sheet.update_cell(2, i, source)
for j in range(3, 18):
while sheet.cell(j, i).value=="":
fact = input("Fact "+str(j-2)+" from source no."+str(i-1)+": ")
sheet.update_cell(j, i, fact)
if sheet.cell(2, i+1).value =="":
while True:
add = input("Would you like to add another fact from source "+str(i-1)+"?(y/n): ")
if add=="y":
factNo = len(sheet.col_values(i))
fact = input("Fact "+str(factNo-3)+" from source no."+str(i-1)+": ")
sheet.update_cell(factNo+1, i, fact)
sheet.update_cell(factNo, 1, factNo-3)
else:
break