Hi
I have grid as ID, Type and FileName. EditTemplate of filename has two controls, fileupload control and textbox. Also I have two commanditems, as "add link", "add file".
<CommandItemTemplate>
<div style="padding: 5px 5px;">
<asp:LinkButton ID="lnkbtnAddNewLink" runat="server" CommandName="InitInsertLink" Visible="true">
<img style="border:0px;vertical-align:middle;width:15px;" alt="" src="../Images/add_record.png" /> Add Link
</asp:LinkButton>
<asp:LinkButton ID="lnkbtnImportFile" runat="server" CommandName="InitInsertFile" Visible="true" >
<img style="border:0px;vertical-align:middle;width:15px;" alt="" src="../Images/add_record.png" /> Import File
</asp:LinkButton>
</div>
</CommandItemTemplate>
<telerik:GridBoundColumn DataField="ID" HeaderText="ID" SortExpression="ID"
UniqueName="AttachmentID">
</telerik:GridBoundColumn>
<telerik:GridTemplateColumn HeaderText="Type" UniqueName="Type"
SortExpression="AttachmentType" HeaderStyle-Width="50px">
<ItemTemplate>
<asp:Label runat="server" ID="lblType" Text='<%# Eval("Type") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:Label runat="server" ID="lblType" Text='<%# Eval("Type") %>'></asp:Label>
</EditItemTemplate>
<telerik:GridTemplateColumn HeaderText="Upload" UniqueName="Upload">
<ItemTemplate>
<asp:Label ID="lblFileName" runat="server" Text='<%# Eval("FileName") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtFileName" runat="server" Text='<%# Eval("FileName") %>'></asp:TextBox>
<asp:FileUpload ID="fpSelectFile" runat="server" MaxFileSize="10240" MaxFileInputsCount="1" InitialFileInputsCount="1" ToolTip="Select a file less than or equal to size of 10KB." />
</EditItemTemplate>
</telerik:GridTemplateColumn>
OnNeedDatasource, I attach the DataTable to the Grid. OnItemCommand, I create new Datarow and insert into the table, and call databind, the new row gets added to the grid, but it is noneditable.
how can I achieve, when user click on Add link, button, I want to set Type=1 and make textbox visible. when user click add file, I have to set Type=0 and make upload control visible.
Thanks
I have grid as ID, Type and FileName. EditTemplate of filename has two controls, fileupload control and textbox. Also I have two commanditems, as "add link", "add file".
<CommandItemTemplate>
<div style="padding: 5px 5px;">
<asp:LinkButton ID="lnkbtnAddNewLink" runat="server" CommandName="InitInsertLink" Visible="true">
<img style="border:0px;vertical-align:middle;width:15px;" alt="" src="../Images/add_record.png" /> Add Link
</asp:LinkButton>
<asp:LinkButton ID="lnkbtnImportFile" runat="server" CommandName="InitInsertFile" Visible="true" >
<img style="border:0px;vertical-align:middle;width:15px;" alt="" src="../Images/add_record.png" /> Import File
</asp:LinkButton>
</div>
</CommandItemTemplate>
<telerik:GridBoundColumn DataField="ID" HeaderText="ID" SortExpression="ID"
UniqueName="AttachmentID">
</telerik:GridBoundColumn>
<telerik:GridTemplateColumn HeaderText="Type" UniqueName="Type"
SortExpression="AttachmentType" HeaderStyle-Width="50px">
<ItemTemplate>
<asp:Label runat="server" ID="lblType" Text='<%# Eval("Type") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:Label runat="server" ID="lblType" Text='<%# Eval("Type") %>'></asp:Label>
</EditItemTemplate>
<telerik:GridTemplateColumn HeaderText="Upload" UniqueName="Upload">
<ItemTemplate>
<asp:Label ID="lblFileName" runat="server" Text='<%# Eval("FileName") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtFileName" runat="server" Text='<%# Eval("FileName") %>'></asp:TextBox>
<asp:FileUpload ID="fpSelectFile" runat="server" MaxFileSize="10240" MaxFileInputsCount="1" InitialFileInputsCount="1" ToolTip="Select a file less than or equal to size of 10KB." />
</EditItemTemplate>
</telerik:GridTemplateColumn>
OnNeedDatasource, I attach the DataTable to the Grid. OnItemCommand, I create new Datarow and insert into the table, and call databind, the new row gets added to the grid, but it is noneditable.
how can I achieve, when user click on Add link, button, I want to set Type=1 and make textbox visible. when user click add file, I have to set Type=0 and make upload control visible.
Thanks