页面代码:
ID="GridView1" runat="server"
           AutoGenerateColumns="False" Width="650px" Font-Size="12px" ForeColor ="#43860c"
           DataKeyNames="user_id" onrowcancelingedit="GridView1_RowCancelingEdit"
           onrowdeleting="GridView1_RowDeleting" onrowediting="GridView1_RowEditing"
           onrowupdating="GridView1_RowUpdating" ondatabound="GridView1_DataBound"
           AllowPaging="True" onrowdatabound="GridView1_RowDataBound"
          >
          
                ReadOnly="True" />
               />
               />
               />
                />
               />
               ReadOnly="True" />
               
                               
                                   
                               
                                 
                                                      
                                                                   
                                 
                                             asp:ListItem>
                                            
                                            
                                  
                           
               />
              
              
          
                 
       
        
           ForeColor="#43860c" Font-Size="12px"
                    Enabled='<%# ((GridView)Container.NamingContainer).PageIndex != 0 %>'
                    CommandName="Page" CommandArgument="First" Font-Underline="False" >
         ForeColor="#43860c" Font-Size="12px"
                    Enabled='<%# ((GridView)Container.NamingContainer).PageIndex != 0 %>'
                    CommandName="Page" CommandArgument="Prev" Font-Underline="False" >
          ForeColor="#43860c" Font-Size="12px"
                    Enabled='<%# ((GridView)Container.NamingContainer).PageIndex != (((GridView)Container.NamingContainer).PageCount - 1) %>'
                    CommandName="Page" CommandArgument="Next" Font-Underline="False" >
           ForeColor="#43860c" Font-Size="12px" 
                    Enabled='<%# ((GridView)Container.NamingContainer).PageIndex != (((GridView)Container.NamingContainer).PageCount - 1) %>'
                    CommandName="Page" CommandArgument="Last" Font-Underline="False" >
                        到第 runat="server" ID="inPageNum" Height="19px" Width="74px">
        
        
      
               
          
 
C#代码
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (((DropDownList)e.Row.FindControl("DropDownList1")) != null)//判断有没有 DropDownList
        {
            DropDownList ddl = (DropDownList)e.Row.FindControl("DropDownList1");
                  string lbl = ((Label)e.Row.FindControl("Label2")).Text;//Label2的值
            ddl.Items.FindByText(lbl).Selected = true;//设置 ddl的默认值
 
        }
    }