Question : datagrid question

if i want to do an if statement to show hide the first button , and the 2 labels below....what would be the order?  0,1,2 ?


<asp:ButtonColumn Text="Remove" CommandName="Delete"></asp:ButtonColumn>
                                                    <asp:TemplateColumn HeaderText="Part#">
                                                          <ItemTemplate>
                                                                <asp:Label id="Label12" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.item") %>'>
                                                                </asp:Label>
                                                          </ItemTemplate>
                                                          <EditItemTemplate>
                                                                <asp:Label id="Label13" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.item") %>' CssClass="textbox1">
                                                                </asp:Label>
                                                          </EditItemTemplate>
                                                    </asp:TemplateColumn>
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
<asp:datagrid id="DataGrid1" tabIndex="10" runat="server" AutoGenerateColumns="False" CssClass="dataGrid" >					
                                <AlternatingItemStyle CssClass="DataGridAlternate"></AlternatingItemStyle>
                                <ItemStyle CssClass="DataGridItem"></ItemStyle>
                                <HeaderStyle CssClass="DataGrid1HeaderStyle"></HeaderStyle>
							    <Columns>
								    <asp:ButtonColumn Text="Remove" CommandName="Delete"></asp:ButtonColumn>
								    <asp:TemplateColumn HeaderText="Part#">
									    <ItemTemplate>
										    <asp:Label id="Label12" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.item") %>'>
										    </asp:Label>
									    </ItemTemplate>
									    <EditItemTemplate>
										    <asp:Label id="Label13" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.item") %>' CssClass="textbox1">
										    </asp:Label>
									    </EditItemTemplate>
								    </asp:TemplateColumn>
								    <asp:TemplateColumn HeaderText="Product">
									    <ItemTemplate>
										    <asp:Label id="lblItemDesc" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.description") %>'>
										    </asp:Label>
									    </ItemTemplate>
									    <EditItemTemplate>
										    <asp:TextBox id="itemDesc" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.description") %>' MaxLength="40" CssClass="textbox1">
										    </asp:TextBox>
									    </EditItemTemplate>
								    </asp:TemplateColumn>
								    <asp:TemplateColumn HeaderText="Qty">
									    <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
									    <ItemStyle HorizontalAlign="Center"></ItemStyle>
									    <ItemTemplate>
										    <asp:TextBox id="itemQty" runat="server" Width="40px" Text='<%# DataBinder.Eval(Container, "DataItem.qty") %>' CssClass="textbox1">
										    </asp:TextBox>
									    </ItemTemplate>
									    <EditItemTemplate>
										    <asp:TextBox id="itemQty1" runat="server" Width="40px" Text='<%# DataBinder.Eval(Container, "DataItem.qty") %>' CssClass="textbox1">
										    </asp:TextBox>
									    </EditItemTemplate>
								    </asp:TemplateColumn>
								    <asp:TemplateColumn HeaderText="Unit Price">
									    <ItemTemplate>
										    <asp:Label id="Label15" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.unitPrice", "${0:N2}") %>'>
										    </asp:Label>
									    </ItemTemplate>
									    <EditItemTemplate>
										    <asp:TextBox id="TextBox5" runat="server" Width="63px" Text='<%# DataBinder.Eval(Container, "DataItem.unitPrice", "${0:N2}") %>' CssClass="textbox1">
										    </asp:TextBox>
									    </EditItemTemplate>
								    </asp:TemplateColumn>
								    <asp:TemplateColumn HeaderText="Total Price">
									    <ItemTemplate>
										    <asp:Label id="Label16" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.totalPrice", "${0:N2}") %>'>
										    </asp:Label>
									    </ItemTemplate>
									    <EditItemTemplate>
										    <asp:Label id="Label17" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.totalPrice", "${0:N2}") %>'>
										    </asp:Label>
									    </EditItemTemplate>
								    </asp:TemplateColumn>
								    <asp:TemplateColumn Visible="False" HeaderText="Line">
									    <ItemTemplate>
										    <asp:Label id="co_line" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.co_line") %>'>
										    </asp:Label>
									    </ItemTemplate>
									    <EditItemTemplate>
										    <asp:Label id="co_line1" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.co_line") %>'>
										    </asp:Label>
									    </EditItemTemplate>
								    </asp:TemplateColumn>
								    <asp:TemplateColumn HeaderText="Whse">
									    <ItemTemplate>
										    <asp:Label id="lblWhse" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.whse") %>'>
										    </asp:Label>
									    </ItemTemplate>
									    <EditItemTemplate>
										    <asp:DropDownList id="lstWhse" runat="server" Width="63px" SelectedIndex='<%# DataBinder.Eval(Container, "DataItem.whsei") %>' DataValueField="whsei" DataTextField="whse" CssClass="textbox1">
											    <asp:ListItem Value="GA">GA</asp:ListItem>
											    <asp:ListItem Value="MO">MO</asp:ListItem>
											    <asp:ListItem Value="NY">NY</asp:ListItem>
											    <asp:ListItem Value="OR">OR</asp:ListItem>
											    <asp:ListItem Value="SALE" Selected="True">SALE</asp:ListItem>
											    <asp:ListItem Value="123">123</asp:ListItem>
										    </asp:DropDownList>
									    </EditItemTemplate>
								    </asp:TemplateColumn>
								    <asp:TemplateColumn HeaderText="Warr Item">
									    <ItemTemplate>
										    <asp:Label id="lblWarrItem" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.warrItem") %>'>
										    </asp:Label>
									    </ItemTemplate>
									    <EditItemTemplate>
										    <asp:TextBox id="warrItem" runat="server" Width="70px" Text='<%# DataBinder.Eval(Container, "DataItem.warrItem") %>' CssClass="textbox1" MaxLength="30">
										    </asp:TextBox>
									    </EditItemTemplate>
								    </asp:TemplateColumn>
								    <asp:TemplateColumn HeaderText="Disc%">
									    <ItemTemplate>
										    <asp:Label id="Label14" runat="server" Width="26px" Text='<%# DataBinder.Eval(Container, "DataItem.disc") %>'>
										    </asp:Label>
									    </ItemTemplate>
									    <EditItemTemplate>
										    <asp:TextBox id="itemDisc" runat="server" Width="40px" Text='<%# DataBinder.Eval(Container, "DataItem.disc") %>' CssClass="textbox1" MaxLength="6">
										    </asp:TextBox>
									    </EditItemTemplate>
								    </asp:TemplateColumn>								    
								    <asp:TemplateColumn HeaderText="Stock">
									    <ItemTemplate>
										    <asp:Label id="Label25" runat="server" Width="26px" Text='<%# DataBinder.Eval(Container, "DataItem.StockQty") %>'>
										    </asp:Label>
									    </ItemTemplate>
									    <EditItemTemplate>
										    <asp:TextBox id="StockQty" runat="server" Width="40px" Text='<%# DataBinder.Eval(Container, "DataItem.StockQty") %>' CssClass="textbox1" MaxLength="10">
										    </asp:TextBox>
									    </EditItemTemplate>
								    </asp:TemplateColumn>	
								    <asp:TemplateColumn HeaderText="Blade Length">
									    <ItemTemplate>
										    <asp:Label id="Label26" runat="server" Width="26px" Text='<%# DataBinder.Eval(Container, "DataItem.item_length") %>'>
										    </asp:Label>
									    </ItemTemplate>
									    <EditItemTemplate>
										    <asp:TextBox id="item_length" runat="server" Width="40px" Text='<%# DataBinder.Eval(Container, "DataItem.item_length") %>' CssClass="textbox1" MaxLength="10">
										    </asp:TextBox>
									    </EditItemTemplate>
								    </asp:TemplateColumn>									    
								    <asp:TemplateColumn HeaderText="Urgent">
									    <ItemTemplate>
										    <asp:CheckBox id="ur1" runat="server" Checked='<%# DataBinder.Eval(Container, "DataItem.urgent") %>'>
										    </asp:CheckBox>
									    </ItemTemplate>
									    <EditItemTemplate>
										    <asp:CheckBox id="ur2" runat="server" Checked='<%# DataBinder.Eval(Container, "DataItem.urgent") %>'>
										    </asp:CheckBox>
									    </EditItemTemplate>
								    </asp:TemplateColumn>
								    <asp:EditCommandColumn ButtonType="LinkButton" UpdateText="Update" CancelText="Cancel" EditText="Edit"></asp:EditCommandColumn>
							    </Columns>
						    </asp:datagrid>

Answer : datagrid question

>> Witch is the way to intercept events fired by AutoCAD?

It depends on how AutoCAD event model. I asked you to attach AutoCAD_TLB file to watch how exactly  ACAD defines its events.

For example if your AutoCAD_TLB looks like this:

TAcadDocumentBeginSave = procedure(ASender: TObject; const FileName: WideString) of object;
...
TAcadDocument = class(TOleServer)
   ....
    property OnBeginSave: TAcadDocumentBeginSave read FOnBeginSave write FOnBeginSave;
    property OnEndSave: TAcadDocumentEndSave read FOnEndSave write FOnEndSave;
    property OnBeginCommand: TAcadDocumentBeginCommand read FOnBeginCommand write FOnBeginCommand;
    property OnEndCommand: TAcadDocumentEndCommand read FOnEndCommand write FOnEndCommand;
   ...

When you can do something like this:

type
  TForm1 = class(TForm)
  ...
  private
     procedure HandlerForAcadDocBeginSave(ASender: TObject; const FileName: WideString);
  ...

procedure TForm1.Button1Click(ASender:TObject);
var
  Acad: IAcadApplication;
  AcadDocument: TAcadDocument;
begin
  Acad := CreateOleObject('AutoCAD.Application')as IAcadApplication;
  Acad.Visible := true;
  AcadDocument:=TAcadDocument.Create(Application);
  AcadDocument.OnBeginSave:= HandlerForAcadDocBeginSave;
  AcadDocument.ConnectTo(Acad.ActiveDocument);  
 ...
Random Solutions  
 
programming4us programming4us