Hello,
Can somebody guided me through on how to create a website to populate images by reading a text file when inserting data in a textboxes from website?
Thank you.
Hello,
Can somebody guided me through on how to create a website to populate images by reading a text file when inserting data in a textboxes from website?
Thank you.
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Manikandan MurugesanPosted Sep 21, 2024, 5:49 AM
Glad that I'm able to help Ivonne and If the provided answer was working then kindly mark my answer as expected!
Ivonne AspilcuetaPosted Sep 19, 2024, 9:22 PM
Hello Manikandan Murugesan,
Do you know how many hours I was looking for that answer, I knew it was something on that line, but noone explain as clear as you just did. Thank you.
Manikandan MurugesanPosted Sep 19, 2024, 5:24 PM
Hi Ivonne,
The onclick event handler for the button is not functioning as expected because the button element is not correctly configured to work with server-side code in ASP.NET WebForms. In ASP.NET, buttons that need to trigger server-side events should be implemented using asp:Button or asp:LinkButton controls instead of regular HTML buttons.
Ivonne AspilcuetaPosted Sep 19, 2024, 4:54 PM
Hello,
This is so far what I did: but my onclick button is not working, I am trying to debug/test but it is not evenrunning when click on button.
Aman GuptaPosted Sep 18, 2024, 12:39 PM
Hi Ivonne,
Yes, I can guide you through the process of creating a website that populates images by reading a text file while allowing users to insert data in textboxes. Here's a step-by-step approach using ASP.NET MVC, assuming you're familiar with .NET.
OverviewWe will create a simple ASP.NET MVC web application where:
- Users input data via textboxes on a form.
- The website reads a text file containing image paths or URLs.
- Based on the form input, relevant images will be displayed.
Steps:1. Set up the ASP.NET MVC Project
2. Create the Model
You’ll need a model to handle the data from the form. For example, you can create a
ProductModelclass with properties for the input fields and images.3. Create the Controller
The controller will handle user input and read from the text file.
4. Create the View
The view (
Index.cshtml) will include textboxes for user input and a section to display images.5. Text File with Image Paths
In your project, create a folder named App_Data. Inside it, create a text file called
ImagePaths.txt. Add image paths or URLs, one per line.Example
ImagePaths.txt:Make sure the images are stored in the appropriate folder (
~/images/in this case).6. Run the Application
- Press F5 to run the application.
- Enter product data into the textboxes and submit the form.
- The images from the text file will be displayed on the page.
Summary:SubmitFormaction in the controller reads the text file containing image paths.Index.cshtml) receives the paths and dynamically displays the images on the page.This example can be extended based on your specific needs, like storing form data in a database or allowing users to upload their own images.
Manikandan MurugesanPosted Sep 17, 2024, 10:31 AM
ID
Certainly! To create a website that displays images based on the content from a text file, and allows users to insert data into textboxes, you'll follow these general steps:
1. Design Your Website Layout
2. Set Up the Website Framework
3. Enable File Upload
4. Process the Text File
5. Update the Website Dynamically
imgtags) to display the images on your webpage. This is usually done with JavaScript or through server-side scripting if you are using a backend.6. Handle User Input
7. Test and Debug
8. Publish Your Website