만든 행에 특성을 추가 할 수 있으며 사용자가 해당 행을 클릭하면 표시 할 개체의 ID가있는 페이지로 리디렉션됩니다. 나는 행 생성에 당신은 예를 들어,의 GridView
를 사용하여 내 예는 데이터 그리드를 사용하고 알고
protected void ListGrid_RowCreated(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType .DataRow)
{
e.Row.Attributes[ "onmouseover"] = "this.style.cursor='pointer';this.style.textDecoration='underline';" ;
e.Row.Attributes[ "onmouseout"] = "this.style.textDecoration='none';" ;
e.Row.ToolTip = "Click to select row";
e.Row.Attributes[ "onclick"] = "Javascript:window.location = '" + ResolveClientUrl("~/PickList/ScanPickListItem.aspx") + "?PLRID=" + DataBinder.Eval(e.Row.DataItem, "ScreenRowId") + "'";
}
}
selectedItem 그 이벤트를 처리의 가치를, 그리고 모든 정보를 읽은 다음 텍스트 상자에 할당 할 특정 컬럼의 인덱스입니다. 필요한 모든 정보가 이미 DataGrid에로드되어 있다고 가정 할 때 SQL 쿼리가 필요한 이유는 무엇입니까? –
에'SELECT all columns from table'과'WHERE' 절에서 그것들을 고유 ID로 필터링하면 그 정보가 텍스트 박스에 있어야합니다. 이걸 타이핑하는 긴 바보 같은 소리가 난다. – Monica
내 제안은 SelectedItem 이벤트를 처리하고, 선택한 ID가 주어지면 짝수 때에도 쿼리를 실행합니다. –