Last post Jun 30, 2010 01:27 PM by aquarious04
Jun 04, 2010 10:41 AM|aquarious04|LINK
Hi I have a table into which I need to insert data. There is some customization required though. I need to create a custom page for the insert.aspx and add a button named prefill to it. There are 10 fields to be inserted in this page. After the user
enters 4 fields and hits the custom added prefill button, rest of the fields should be populated based on the availability in my database. If data is not available based for prefill a message must be displayed saying "prefill is not possible". How can I do
Jun 04, 2010 11:39 AM|compguy2100|LINK
You could probably get away with something along these lines - I just made up your 4 parameters that they would initially submit:
protected void btnPreFill_Click(object sender, EventArgs e)
string Param1 = txtParam1.Text;
string Param2 = txtParam2.Text;
string Param3 = txtParam3.Text;
string Param4 = txtParam4.Text;
SqlConnection con = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings("MyConnectionString"));
SqlCommand command = new SqlCommand();
command.CommandText = "SELECT * FROM UserData WHERE Param1 = " + Param1 + ", AND Param2 = " + Param2 + ", AND Param3 = " + Param3 + ", AND Param4 = " + Param4;
command.CommandType = CommandType.Text;
command.Connection = con;
SqlDataAdapter da = new SqlDataAdapter(command);
DataSet ds = new DataSet();
if (ds.Tables(0).Rows.Count > 0)
// This is where you populate your 6 other fields on the page
//Do something else, here
lableMessages.Text = "Pre-fill is not possible"
Jun 04, 2010 12:06 PM|sjnaughton|LINK
The easyest way would be to create a traditional ASP.Net web forms page to do this, you can still map it to the Insert action and if you like and put it in the CustomPages folder.
Jun 04, 2010 12:51 PM|aquarious04|LINK
I need this for my dynamic data entitites web application. How do I prefill the textboxes in the insert.aspx page in the dynamic data entities web application?
Jun 04, 2010 12:55 PM|aquarious04|LINK
do you mean the textboxes to be prefilled must be traditional asp.net textboxes and not the ones displayed in the insert template?
How can I map the data in the traditional text boxes to the insert action of dynamic data?
Jun 30, 2010 01:27 PM|aquarious04|LINK
can you tell me how to map traditional web forms page to the insert action?