Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
テーブルからデータを取得し、次の方法で保存しています。
while (results.Read()) { ListItem newItem = new ListItem(); newItem.Text = results["TEXT_CONTENT"].ToString(); newItem.Value = results["ID"].ToString(); }
これで、リストの最初の値を入力する必要があるテキスト ボックスができました。これを達成する方法は?
while (results.Read()) { if (String.isNullOrEmpty(txt.Text)) { txt.Text = results["TEXT_CONTENT"].ToString(); } ListItem newItem = new ListItem(); newItem.Text = results["TEXT_CONTENT"].ToString(); newItem.Value = results["ID"].ToString(); }