在编辑行时,在GridView中动态替换带有下拉列表的TextBox

时间:2016-05-10 10:20:53

标签: c# asp.net gridview

我有1个gridview来绑定来自多表(动态表)的数据。在某些表中,我需要在编辑行时将文本框更改为下拉列表。 如何使用条件将文本框更改为下拉列表?

OnRowDataBound:

At C:\Users\user\Desktop\LeaverScript.ps1:64 char:148
+ ... ce you came ..."
+                    ~
The string is missing the terminator: ".
At C:\Users\user\Desktop\LeaverScript.ps1:34 char:8
+                     0 {
+                       ~
Missing closing '}' in statement block.
At C:\Users\user\Desktop\LeaverScript.ps1:33 char:5
+                 {
+                 ~
Missing closing '}' in statement block.
At C:\Users\user\Desktop\LeaverScript.ps1:1 char:15
+ $FieryChasm = {
+               ~
Missing closing '}' in statement block.
    + CategoryInfo          : ParserError: (:) [], ParseException
    + FullyQualifiedErrorId : TerminatorExpectedAtEndOfString

GridView:

for (int i = 0; i < gvForm.HeaderRow.Cells.Count; i++)
{
    if (gvForm.HeaderRow.Cells[i].HasControls())
    {
        if (gvForm.HeaderRow.Cells[i].Controls[0] is LinkButton)
        {
            LinkButton headerControl = gvForm.HeaderRow.Cells[i].Controls[0] as LinkButton;
            string headerName = headerControl.Text;
            if (headerName.Equals("JenisMataUang"))
            {
                // some code to replace textboxt to dropdown list
            }
        }
    }
}

0 个答案:

没有答案