0
나는이 컨트롤이 usercontrol 안에있는 htmleditorextender에 첨부되어 있으며이 사용자 컨트롤은 업데이트 패널에있는 데이터 목록 컨트롤 안에 있습니다. 나는 텍스트 박스가 보여지는 클릭 링크에 편집 링크 버튼을 가지고 있으며,이 때 나는이 작업을 시도한 텍스트 박스에 초점을 맞추고 싶다.은 업데이트 패널 내에 htmleditorextendor가있는 텍스트 상자에 포커스를 설정합니다.
protected void lnkEditResponse_OnCommand(object sender, CommandEventArgs e)
{
if (QuestionList.Items.Count == 0)
{
log.Warn("There are no items in the data list.");
return;
}
try
{
DataListItem item = QuestionList.Items[int.Parse(e.CommandArgument.ToString())];
if (item == null)
{
log.Warn("No item found for the index " + e.CommandArgument);
return;
}
Panel responseLabelPanel = item.FindControl("ResponseLabelPanel") as Panel;
Panel responseInputPanel = item.FindControl("ResponseInputPanel") as Panel;
TextBox textArea = item.FindControl("QuestionResponseTextBox") as TextBox;
responseLabelPanel.Visible = false;
responseInputPanel.Visible = true;
ScriptManager mgr = ScriptManager.GetCurrent(this.Page);
(responseInputPanel.FindControl("LinkClearAll") as LinkButton).Visible = true;
(responseInputPanel.FindControl("lnkClear") as LinkButton).Visible = true;
ScriptManager.RegisterStartupScript(this, this.GetType(), "f", "document.getElementById('" + textArea.ClientID + "').focus();", true);
}
catch (Exception ex)
{
log.Error("Exception while handling file delete.", ex);
}
}
또한 texbox를 가져 와서 .Focus()를 시도했지만 작동하지 않는 방법이 있습니다.
추 신 : 그 매우 중요 텍스트 상자에 현재 텍스트의 끝에 초점을 설정 (텍스트 상자는 데이터베이스에서 데이터로로드됩니다)