2011-09-09 138 views

回答

0

也許您的GridView使用模板字段,並且您的屬性«.Text»始終爲空。

建議:在«sw.Write(dr.Cells [i] .Text)中放置一個斷點;»並檢查您的Cells [i]對象。搜索要放入文件的屬性。可能你需要做一些演員才能獲得你想要的正確價值。 (((TextBox)dr.Cells [i] .Controls [0]).Text);

希望這會有所幫助。

+0

嗨Jeison謝謝你給我的迴應,我試試這個sw.Write(((TextBox)dr.Cells [i] .Controls [0])。以ge tvalues,但它顯示錯誤,如「無法將類型'System.Web.UI.LiteralControl'的對象類型'System.Web.UI.WebControls.TextBox'。」 – Victor

+0

我正在使用gridview模板字段。 – Victor

相關問題