Hello,
<asp:DataGrid ID="dg1" AllowPaging="Tr ue" AllowSorting="T rue"
AlternatingItem Style-BackColor="#ccc cff"
AlternatingItem Style-Font-Name="arial"
AlternatingItem Style-ForeColor="#333 366" CellPadding="3"
DataKeyField="e mpid" OnPageIndexChan ged="chgpage"
OnSortCommand=" sortdg" PageSize="10" PagerStyle-Mode="NumericPa ges"
Runat="server" PagerStyle-HorizontalAlign ="Center"
OnSelectedIndex Changed="chgsel " SelectedItemSty le-BackColor="#FF0 000"
AutoGenerateCol umns="False" PagerStyle-BackColor="#468 2b4"
PagerStyle-Font-Bold="True" PagerStyle-ForeColor="#FFF F00"
PagerStyle-Font-Name="arial,ver dana" BorderColor="#4 682b4"
BorderStyle="So lid" BorderWidth="2"
OnEditCommand=" chkedit" OnCancelCommand ="chkcancel"
OnUpdateCommand ="chkupd" OnItemCommand=" chkitem">
<HeaderStyle Font-Name="arial,ver dana" ForeColor="#FFF F00"
BackColor="#468 2b4"></HeaderStyle>
<Columns>
<asp:BoundColum n DataField="empi d" HeaderText="Emp ID"
SortExpression= "empid" ReadOnly="True" ></asp:BoundColumn >
<asp:BoundColum n DataField="empn ame" HeaderText="Nam e"
SortExpression= "empname"></asp:BoundColumn >
<asp:BoundColum n DataField="pass portno" HeaderText="Pas sport
No"></asp:BoundColumn >
<asp:BoundColum n DataField="curb asic" HeaderText="Bas ic"
SortExpression= "curbasic"> </asp:BoundColumn >
<asp:EditComman dColumn EditText="Edit" CancelText="Can cel"
UpdateText="Upd ate" HeaderText="Edi t Item">
<ItemStyle HorizontalAlign ="Center" Wrap="False"></ItemStyle>
</asp:EditCommand Column>
<asp:ButtonColu mn HeaderText="Del ete Item" Text="Delete"
ButtonType="Pus hButton" CommandName="de lete"></asp:ButtonColum n>
</Columns>
</asp:DataGrid>
in the onitemcommand procedure,
select case ctype(e.command source,button). commandname
case "delete"
delete()
end select
when i press delete button, its working fine. For any other operation(sort,
page changed, edit or cancel or update) displaying an error "cast invalid at
ctype(e.command source,button). commandname "
Coz edit and cancel are LinkButtons and Delete is Pushbutton.
How can i validate whether e.commandsource is button or linkbutton?
And when i click Edit, datagrid columns are incorporated with textboxes
those who have been allowed for editing. Here, the textbox is displaying its
default size. How can i specify diff widths for each textbox in each column?
thanks in advance