|
I'm trying to request a variable from the url to pass into a stored procedure that will query the database and return the desired information but when I typed:
Dim Request As Integer = Request.Querystring("ID")
it returns the error 'querystring' not a memeber of string.
has anyone attempted something similiar and if so can they advise me on what i should do? Any help is most appreciated.
|
|
|
|
|
Request.Querystring returns a string, your Request variable is an Integer, you need convert the string to an integer before assigning it.
|
|
|
|
|
No, I think VB will accept this and do the conversion itself. I think the problem is that he's named his string 'Request'.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
You define Request as string, then try to access the Request object. You're confusing the compiler, it's trying to find the QueryString method on a string called Request. Call it something sensible.
Because you're using VB, I suspect you will get an integer without casting, but just because VB is crap, doesn't mean your code has to be. Use int.TryParse to work out if the value returned is a number or not, and set a default if it's not.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Thanks got it sorted yeah was because I was using request. I know the id being past as an integer so renamed and kept as integer works fine. Thanks guys for the help.
|
|
|
|
|
Hi All,
I have added a user control at runt time to my web form. But the button click event in the user control is not working. The control itself is not going in to the event handler. Please can any body help me. And I am using the below code
protected void LoadExampleUserControl()
{
try
{Control controlToLoad;
controlToLoad = this.LoadControl(pathToUserControls);
controlToLoad.EnableViewState = true;
this.div1.Controls.Add(controlToLoad);
}
catch { }
}
And I am calling this method in Page load event. I am I doint wrong. If so please give me suggestion. Or any help.
Thanks,
Aleem Mohammad.
S/W Engineer
Akebono Soft Technologies
aleem_abdul@akebonosoft.com.
|
|
|
|
|
Make sure you are not calling this function inside !IsPostBack block. You need to add user control each time when page refreshes. AFAIK, page_load is not a safe place for dynamic controls. Override OnInit event and add your control there, ASP.NET can manage viewstate for this control then. Don't check IsPostBack there.
|
|
|
|
|
Thanks it is done Nav. Thank you very much.
S/W Engineer
Akebono Soft Technologies
aleem_abdul@akebonosoft.com.
|
|
|
|
|
I've just spent about two hours figuring out why a simple FormView, with only an InsertItemTemplate, and a SqlDataSource with a simple stored proc insert command, just would not insert. No exception was thrown, and even the ItemInserted event was firing, but in the DB? Nadda!
Then I realised I was probably adding a bad parameter to the Values collection in the ItemInserting even, and sure enough, the code below works because the commented out line refers to a non-existent parameter, but nothing tells one this. I like exceptions!
<code>
protected void fvTest_ItemInserting(object sender, FormViewInsertEventArgs e)
{
e.Values["commentTypeId"] = 1;
//e.Values["feedbackRefNum"] = GetFeedbackRefNo();
}
</code>
|
|
|
|
|
Brady Kelly wrote: an InsertItemTemplate, and a SqlDataSource with a simple stored proc insert command
Arrghhhhh. I hate the ...DataSource objects. It's such an untidy hack.
|
|
|
|
|
Wonderful for quick prototyping, or even real use, in very simple capture - view applications. Especially useful where the data structures change often.
|
|
|
|
|
Nope - the SqlDataSource is the hellborn son of Stan.
|
|
|
|
|
Pete O'Hanlon wrote: hellborn son of Stan
Can I assume the misspelling is intentional?
|
|
|
|
|
Brady Kelly wrote: SqlDataSource
That stuff is nasty, I never use it
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I actually like it, this is the first time I've been bitten.
|
|
|
|
|
Hi all,
I am creating my database using the server explorer in VS 2005, I defined almost all tabes and relations I need except that I don't know how to impose a 'unique' constraint on a specific column called "username".
Any idea on how to do this using Server explorer?
Thanks
And ever has it been that love knows not its own depth until the hour of separation
|
|
|
|
|
This isn't the right forum for SQL questions. You should use the SQL forum in future.
Open your table in design mode. From the 'Table Designer' menu, select Indexes/Keys. Create a new index and set its 'Is Unique' property to True.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Thanks for the answer.. Done!
And ever has it been that love knows not its own depth until the hour of separation
|
|
|
|
|
hello all,
i need to know if i can call the web form as if it is a class that i can inherite or take an object of it
thanks in advance
abdelhameed81
|
|
|
|
|
abdelhameed81 wrote: i need to know if i can call the web form as if it is a class that i can inherite or take an object of it
You could have a number of of web forms that inherit from the same code-behind class.
I can't imagine why you would want to create an instance of a web form code-behind class on its own though. Maybe you can further clarify what you want to achieve.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
thanks for replying. The idea is that i need to access a control inside that form to make some modifications in that user control instead of creating many user controls with some minor changes.
I hope that i made the idea clearer. Thanks
|
|
|
|
|
This sounds like a horrible idea. I would strongly discourage it.
What kind of minor changes are you talking about? If they are cosmetic changes, you could consider writing a templated user control where the presentation can be modified for each instance.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
mmmm
this sounds like a good idea, thanks for your support
|
|
|
|
|
Your web form is a class already. You can inherit from it, create an instance of it (making an object of it) and so on.
But, why would you want to create one outside of the context that ASP.NET creates it for you in the first place?
|
|
|
|
|
thanks
please refer to my reply on pmarfleet
Br,
|
|
|
|