출처: http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.detailsview.itemupdating%28v=vs.110%29.aspx

가끔 데이터 입력시 확인이 필요하거나 자동으로 입력이 필요할 때가 있다.

이때 필요한 것들

void CustomerDetail_ItemInserting(object sender, 
    DetailsViewInsertEventArgs e)
  {
    // Iterate though the values entered by the user and HTML encode 
    // the values. This helps prevent malicious values from being 
    // stored in the data source.
    for (int i = 0; i < e.Values.Count; i++)
    {
      if (e.Values[i] != null)
      {
        e.Values[i] = Server.HtmlEncode(e.Values[i].ToString());
      }
    }
  }


Posted by 노을지기

버튼으로 DetailsView의 모드를 변경할 경우가 있다.

이때 모드 확인 후 사용하기

// check the Detail View Mode
 if (DetailsView1.CurrentMode == DetailsViewMode.Insert)
{
      DetailsView1.ChangeMode(DetailsViewMode.ReadOnly);
 } 

 mode는 3가지가 있다.

edit, insert, readonly


Posted by 노을지기

출처: http://brian.chipsofttech.com/post/DetailsView-Confirm-Delete.aspx

itemCreated 이벤트에서 사용하면 된다.

protected void DetailsView1_ItemCreated(object sender, EventArgs e)
        {
            // Test FooterRow to make sure all rows have been created
            if (DetailsView1.FooterRow != null)
            {
                // The command bar is the last element in the Rows collection
                int commandRowIndex = DetailsView1.Rows.Count - 1;
                if (commandRowIndex > 0)
                {
                    DetailsViewRow commandRow = DetailsView1.Rows[commandRowIndex];
                    // Look for the DELETE button
                    DataControlFieldCell cell = (DataControlFieldCell)commandRow.Controls[0];
                    foreach (Control ctl in cell.Controls)
                    {
                        LinkButton link = ctl as LinkButton;
                        if (link != null)
                        {
                            if (link.CommandName == "Delete")
                            {
                                link.ToolTip = "Click here to delete";
                                link.OnClientClick = "return confirm('Do you really want to delete this record?');";
                            }
                        }
                    }
                }
            }
        }

Posted by 노을지기

출처: http://stackoverflow.com/questions/987672/format-make-bold-or-italics-a-portion-of-a-textbox-or-formula-object-in-crysta


You can do this by inserting HTML markup in the field (using a formula) and then displaying the new formula as a HTML field.

e.g. Here's a basic Syntax formula that takes a field and adds the bold tag around the text before the colon.

dim sTmp as string 
dim sLeft as string 
dim sRight as string 
dim sAll as string 

sTmp = {yourtable.yourfield}

sLeft = (split(sTmp,":"))(1)
sRight = (split(sTmp,":"))(2)

sAll = "<b>"+sLeft+":</b>"+sRight
formula = sAll

If you place this new formula into the report and then ...

  • Right Click the field and choose "Format Field"
  • Change Text Interpretation to HTML Text
  • Click 'OK'

<p style="font-family:arial;text-align:center;font-weight:bold;color:black;font-size:10px;">A paragraph.</p>


Posted by 노을지기

Crystal report에서 section을 조건에 따라 활성화 및 비활성화를 시킬 수 있다.


if {?TYPE} ="inv_type01" Then
 
    False

else

    True;



Posted by 노을지기