Showing posts with label populate. Show all posts
Showing posts with label populate. Show all posts

Thursday, March 29, 2012

passing values

hi guys, hello :) im new to asp.net and come from php "gasp" - anyway, i have a list of car categories and when i click an item i want it to populate the datalist with the data, ie - if you click Car1 = select * from Car1.

I already have a search facility, which calls a stored procedure which loads the data by part number. but im not sure how to do this.

the categories are in the same form, so once a category is clicked it loads the data into the same formI'm not sure I follow what the issue is... Having a button postback? Generating the results? Displaying the results?
Hi curt sorry if i confused you

basically i have this function set up

sub loaddata(s as object, e as evenargs)
dim cmd as new sqldataadapter("select * from varCategory", objConn)
objDA.Fill(objDS, "parts")
dgData.Datasource= objDS
dgData.Databind()
objconn.close()

ok now on my form i have a list of cars, and what i want it to do is call this procedure when a car is clicked, and pass on the value of that car to varCategory.

how can i do this?

Hi!

You could call it like this:

Try
cmd =New SqlCommand("usp_TrackUser", objConn)
cmd.CommandType = CommandType.StoredProcedure
cmd.Parameters.Clear()
cmd.Parameters.Add("@.varCategory", varCategory)
If objConn.State <> ConnectionState.OpenThen objConn.Open()
'execute or asggin to adpater
cmd.ExecuteNonQuery()
Catch exAs System.Exception
'show the error
EndTry

Review the next article:Call a parameterized SP in SQL

Saludos,


What is this "list"? Dropdown? Grid? Etc?

Most controls have an event you can tie to (Click, etc) you can also usually set the control to "autopostback" and allow this event to cause the page to post....

Monday, March 26, 2012

passing values to showmodal dialog

I have parent.aspx web page from which I call a modal dialog (child.aspx via
showmodaldialog). I'd like to populate two text boxes, <asp:TextBox id=txt
_HN> on the child form with data from the caller.
for parent.aspx....
<script> block
function UpdH(title,horse)
{
var iParms=new Object();
iParms.Name=horse;
...}
for child.aspx...
<script> block
I've tried "document.getElementById('txt_HN').value=iParms.Horse;" within ch
ild.aspx form - but get error "document.getElementbyId(...) is null or not a
n object". How do I do this?David,
Try dialogArguments.window.document.getElementById....
using the following to open your window in java script:
var TestWindow = new Object();
TestWindow.caller = window.showModalDialog(URLstr, window, sFeatures);
replacing the parameters there with whatever you use as appropriate.
Raymond Lewallen
"DavidS" <DavidS@.discussions.microsoft.com> wrote in message
news:564EE97A-8C7D-4E35-B034-99BB78A95904@.microsoft.com...
> I have parent.aspx web page from which I call a modal dialog (child.aspx
via showmodaldialog). I'd like to populate two text boxes, <asp:TextBox
id=txt_HN> on the child form with data from the caller.
> for parent.aspx....
> <script> block
> function UpdH(title,horse)
> {
> var iParms=new Object();
> iParms.Name=horse;
> ...}
> for child.aspx...
> <script> block
> I've tried "document.getElementById('txt_HN').value=iParms.Horse;" within
child.aspx form - but get error "document.getElementbyId(...) is null or not
an object". How do I do this?

passing values to showmodal dialog

I have parent.aspx web page from which I call a modal dialog (child.aspx via showmodaldialog). I'd like to populate two text boxes, <asp:TextBox id=txt_HN> on the child form with data from the caller.
for parent.aspx....
<script> block
function UpdH(title,horse)
{
var iParms=new Object();
iParms.Name=horse;
...}
for child.aspx...
<script> block
I've tried "document.getElementById('txt_HN').value=iParms.Hor se;" within child.aspx form - but get error "document.getElementbyId(...) is null or not an object". How do I do this?David,

Try dialogArguments.window.document.getElementById... .

using the following to open your window in javascript:

var TestWindow = new Object();
TestWindow.caller = window.showModalDialog(URLstr, window, sFeatures);

replacing the parameters there with whatever you use as appropriate.

Raymond Lewallen

"DavidS" <DavidS@.discussions.microsoft.com> wrote in message
news:564EE97A-8C7D-4E35-B034-99BB78A95904@.microsoft.com...
> I have parent.aspx web page from which I call a modal dialog (child.aspx
via showmodaldialog). I'd like to populate two text boxes, <asp:TextBox
id=txt_HN> on the child form with data from the caller.
> for parent.aspx....
> <script> block
> function UpdH(title,horse)
> {
> var iParms=new Object();
> iParms.Name=horse;
> ...}
> for child.aspx...
> <script> block
> I've tried "document.getElementById('txt_HN').value=iParms.Hor se;" within
child.aspx form - but get error "document.getElementbyId(...) is null or not
an object". How do I do this?