셰이프의 양식 편집 목록에 ID 필드를 표시해야합니다.편집 양식, 공유 목록의 읽기 전용으로 ID 필드를 표시하는 방법은 무엇입니까?
할 수있는 방법이 있습니까? 계산 된 필드와 아무 것도 시도하지 않았습니다. 보기에서 ID 필드를 볼 수 있고 액세스 모드로 표시하면 알 수 있습니다. WSS3.0을 사용 중입니다.
셰이프의 양식 편집 목록에 ID 필드를 표시해야합니다.편집 양식, 공유 목록의 읽기 전용으로 ID 필드를 표시하는 방법은 무엇입니까?
할 수있는 방법이 있습니까? 계산 된 필드와 아무 것도 시도하지 않았습니다. 보기에서 ID 필드를 볼 수 있고 액세스 모드로 표시하면 알 수 있습니다. WSS3.0을 사용 중입니다.
add the ID field to the form using some JavaScript in a CEWP 수 있습니다.
<script type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js">
</script>
<script type="text/javascript">
$(function() {
// Get the ID from the query string
var id = getQueryString()["ID"];
// Find the form's main table
var table = $('table.ms-formtable');
// Add a row with the ID in
table.prepend("<tr><td class='ms-formlabel'><h3 class='ms-standardheader'>ID</h3></td>" +
"<td class='ms-formbody'>" + id + " </td></tr>");
})
function getQueryString() {
var assoc = new Array();
var queryString = unescape(location.search.substring(1));
var keyValues = queryString.split('&');
for (var i in keyValues) {
var key = keyValues[i].split('=');
assoc[key[0]] = key[1];
}
return assoc;
}
</script>
가볍게 유지하려는 경우 대체 method that doesn't use the jQuery library이 있습니다.
감사의 라이언. 그게 전부 야. 매우 쉽게 구현할 수 있습니다. –
사용자 정의 편집 양식을 아주 쉽게 만들면됩니다. 나는 보통 웹 파트 내 렌더링 된 HTML 테이블에 그것을 꽂는다. 그렇게하는 것이 더 나은 방법 일 수 있지만 간단하고 효과적입니다.
보고 싶은 핵심 줄은 spFormField.ControlMode입니다. 그러면 SharePoint에 컨트롤 표시 방법 (잘못된, 표시, 편집, 새로 만들기)이 표시됩니다. 그렇다면 spField.InternalName == "ID"인지 확인하고, 그렇다면 ControlMode를 Display로 설정하십시오.
나머지는 나머지 목록을 렌더링하기위한 보풀입니다.
희망이 도움이됩니다.
HtmlTable hTable = new HtmlTable();
HtmlTableRow hRow = new HtmlTableRow();
HtmlTableCell hCellLabel = new HtmlTableCell();
HtmlTableCell hCellControl = new HtmlTableCell();
SPWeb spWeb = SPContext.Current.Web;
// Get the list we are going to work with
SPList spList = spWeb.Lists["MyList"];
// Loop through the fields
foreach (SPField spField in spList.Fields)
{
// See if this field is not hidden or hide/show based on your own criteria
if (!spField.Hidden && !spField.ReadOnlyField && spField.Type != SPFieldType.Attachments && spField.StaticName != "ContentType")
{
// Create the label field
FieldLabel spLabelField = new FieldLabel();
spLabelField.ControlMode = _view;
spLabelField.ListId = spList.ID;
spLabelField.FieldName = spField.StaticName;
// Create the form field
FormField spFormField = new FormField();
// Begin: this is your solution here.
if (spField.InteralName == "ID")
{ spFormField.ControlMode = SPControlMode.Display; }
else
{ spFormField.ControlMode = _view; }
// End: the end of your solution.
spFormField.ListId = spList.ID;
spFormField.FieldName = spField.InternalName;
// Add the table row
hRow = new HtmlTableRow();
hTable.Rows.Add(hRow);
// Add the cells
hCellLabel = new HtmlTableCell();
hRow.Cells.Add(hCellLabel);
hCellControl = new HtmlTableCell();
hRow.Cells.Add(hCellControl);
// Add the control to the table cells
hCellLabel.Controls.Add(spLabelField);
hCellControl.Controls.Add(spFormField);
// Set the css class of the cell for the SharePoint styles
hCellLabel.Attributes["class"] = "ms-formlabel";
hCellControl.Attributes["class"] = "ms-formbody";
}
}
당신이 프런트 엔드 또는 목록 정의 기능을 통해 귀하의 목록을 작성하고 있습니까? 사용자 정의 편집 양식이 옵션입니까? – Shaneo
프런트 엔드를 통해 생성. 예, 맞춤 편집 양식은 옵션입니다. –