Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Change parameter value using a control 1

Status
Not open for further replies.

rdgerken

Technical User
Jul 8, 2002
108
0
0
Hi all,

I'd like to change the default value of a select parameter using a link button to change the value of this parameter from True to False and vice versa. The only problem is that I don't know how to access the parameter.defaultvalue in the code. I have been able to get this to work using a check box and pointing a controlparameter to the checked property, but this isn't really what I want. I'd like to use a link button to toggle between the two states.

Can someone help me do this the right way?

Thanks
 
rd: do you want to toggle client side or send it back to the server? Javascript could take care of this -- ?? What object are you changing? Checkbox??? Perhaps the relevant code might help here.
 
use the click event of the link button. Check the value and reverse as necessary.
 
jben: That was my initial thought as well - to just check with server side code; but wasn't sure exactly what was being ask -- sometimes it is the obvious!
 
jben: this is what I wanted to do, but in the click event, how do I access the parameter's default value to change it? That is what I'm having trouble with. I'm sorry the OP was confusing - sometimes its hard to get down what you are really after.

thanks for the responses
 
Code:
<asp:SqlDataSource ID="SqlUser" runat="server" ConnectionString="<%$ ConnectionStrings:StagingConnectionString %>"
        SelectCommand="SELECT * FROM [User] WHERE ([UserActive] = @UserActive) ORDER BY UserName" EnableCaching="false">
        <SelectParameters>
            <asp:Parameter DefaultValue="True" Name="UserActive" Type="Boolean" />
        </SelectParameters>
    </asp:SqlDataSource>

Here I have a select parameter with the default value of "True" - how can I access this parameter through the code and change it to "False" using a link button to toggle the value back and forth? That's what I'm after. I wasn't able to figure out how to access this selectparameter to manipulate the value. I have only been successful using controlparameter with like a checkbox's checked property, but in this case, I don't want a checkbox, I want a link button to toggle the state.

Thanks!
 
I imagine it will be something like this:
Code:
SqlUser.SelectParameters("UserActive").DefaultValue = False



____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top