Does ne one knw how to create an uneditable text file ?
plz tell me.....n also about check box in datagrid....
Does ne one knw how to create an uneditable text file ?
plz tell me.....n also about check box in datagrid....
Thread asks how to make a text file effectively non-editable and how to add checkboxes to a DataGrid. started this, and gave a quick tip earlier. Below are practical, durable approaches for VB.NET / ASP.NET that avoid fragile hacks and work in real deployments.
For protecting a file: prefer server-side or filesystem controls rather than client-side tricks. Keep the canonical copy on the server (or in a database) and serve a read-only view. For files on NTFS use the Security tab in Explorer to remove Write/Modify for the accounts that should not edit the file; test with a non-admin account to confirm. Server processes that need to write should use a dedicated service account with explicit rights. Also consider programmatic ACL changes (FileSecurity/FileSystemAccessRule) or monitoring (checksums/audit) if you need automated enforcement. Note: anyone with administrative or physical access can override OS-level protections, and you cannot stop edits to a file once a user downloads and owns a local copy.
For checkbox selection in a DataGrid (VB.NET WebForms), use a TemplateColumn with a CheckBox and a hidden field to keep the record ID. On postback iterate the DataGrid items and read the checkbox and the hidden ID. Example markup:
<asp:DataGrid ID="dgPeople" runat="server" AutoGenerateColumns="False">
<Columns>
<asp:TemplateColumn>
<ItemTemplate>
<asp:CheckBox ID="chkSelect" runat="server" />
<asp:HiddenField ID="hidId" runat="server" Value='<%# Eval("ID") %>' />
</ItemTemplate>
</asp:TemplateColumn>
<asp:BoundColumn DataField="Name" HeaderText="Name" />
</Columns>
</asp:DataGrid> And server-side iteration:
For Each item As DataGridItem In dgPeople.Items
Dim cb As CheckBox = CType(item.FindControl("chkSelect"), CheckBox)
If cb IsNot Nothing AndAlso cb.Checked Then
Dim hid As HiddenField = CType(item.FindControl("hidId"), HiddenField)
Dim id As String = hid.Value
' process id
End If
Next Troubleshooting notes: do not rebind the grid on every postback (wrap binding in If Not IsPostBack), ensure ViewState or hidden fields preserve values, and test permission changes using realistic accounts. If building a new app, consider GridView/ListView for built-in selection features.
Jump to Post— Jx_Man 987>> Does ne one knw how to create an uneditable text file ?
- Set text file attribute as ReadOnly.
>> check box in datagrid....
- I don't know about checkbox on datagrid, but you can use listview, there are check box option on listview properties.
>> Does ne one knw how to create an uneditable text file ?
- Set text file attribute as ReadOnly.
>> check box in datagrid....
- I don't know about checkbox on datagrid, but you can use listview, there are check box option on listview properties.
plz brief me up about the list view.....it will be a great help !
thanks
cya
Rohan
>> Does ne one knw how to create an uneditable text file ?
- Set text file attribute as ReadOnly.
>> check box in datagrid....
- I don't know about checkbox on datagrid, but you can use listview, there are check box option on listview properties.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.