2012-12-13 3 views
2

Gridview 호출기 안에 컨트롤을 삽입하려고합니다. 컨트롤이 성공적으로 표시되지만 그림에서 볼 수있는 것처럼 이전 컨트롤 아래에 컨트롤이 지정됩니다.Gridview 호출기 안에 사용자 지정 단추 삽입

enter image description here

나는 다음과 같은 코드를 추가하고있다.

if (e.Row.RowType == DataControlRowType.Pager) 
{ 
    e.Row.Cells[0].Controls.Add(ImageButton1); 
} 

원하는 것은 이전 버튼 옆에있는 답변 저장 버튼을 지정하는 것입니다. 어떤 도움 pls?

+0

것은 아니, 난 템플릿을하지 않습니다. 난 단지 EnablePaging을 가지고 – user1292656

답변

2
if (e.Row.RowType == DataControlRowType.Pager) 
{ 
    Table pagerTable = (e.Row.Cells[0].Controls[0] as Table); 
    TableRow row = new TableRow(); 
    row = pagerTable.Rows[0]; 
    TableCell cell1 = new TableCell(); 
    cell1.Controls.Add(ImageButton1); 

    row.Cells.AddAt(1,cell1); 
} 
0

어쩌면 당신은 당신의있는 gridview에 호출기 스타일을 추가 할 수 있습니다

<PagerStyle Width="100%" /> 

이 왜 내부 사용자의 버튼으로 pagertemplate을 만들 수 있습니까? 각 버튼의 위치를 ​​쉽게 정의 할 수 있습니다.

<asp:gridview id="CustomersGridView" 
     datasourceid="CustomersSource" 
     autogeneratecolumns="false" 
     emptydatatext="No data available." 
     allowpaging="true" 
     runat="server"> 
... 
     <pagerstyle Width="100%"/> 

     </asp:gridview> 
+0

아무 세포가 없습니다 :) – user1292656

+0

어떻게 할 수 있습니까? – user1292656

+0

다시 작동하지 않습니다 – user1292656