|
Hi
In VS 2005 i want when user select an Item of RadioButtonList, the Page postback or SelectedIndexChanged event be fire automaticly.
How can i do that?
|
|
|
|
|
sasan56 wrote: In VS 2005 i want when user select an Item of RadioButtonList
VS is just an editor. It has nothing to do with RadioButtonList .
sasan56 wrote: Page postback or SelectedIndexChanged event be fire automaticly.
Set the AutoPostBack=true
|
|
|
|
|
What is the problem in this you have SelectedIndexChanged event in radiobutton list which u can use to fire any events depending upon the option selected.
|
|
|
|
|
Set AutoPostBack=true
cheers,
Abhijit
CodeProject MVP
|
|
|
|
|
Thanks for reviewing my question. I hope this is the right forum.
I am trying create a sqldatasource, menu control, grid view controll, and ajax update panel which will be added dynamically during runtime in a for loop. the code below works except that I must click on the menu item twice to get it to requery the database and update the gridview. Any suggestions why this is. i am using visual studio 2008.
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim up1 As UpdatePanel = New UpdatePanel()
up1.ID = "up1"
'--Menu---
Dim menu3 As New Menu()
Menu3.ID = "menu3"
Dim i As Integer
For i = 2005 To 2009
Dim mItem As New MenuItem(i.ToString, i.ToString)
menu3.Items.Add(mItem)
Next
menu3.Orientation = Orientation.Horizontal
menu3.StaticMenuItemStyle.HorizontalPadding = 5
up1.ContentTemplateContainer.Controls.Add(menu3)
'---DataSource----
Dim ds As SqlDataSource = New SqlDataSource()
ds.ConnectionString = "my connection string"
ds.SelectCommand = "SELECT * FROM table WHERE filedate > @filedate"
'--ControlParemeter-----
Dim cp As ControlParameter = New ControlParameter()
cp.ControlID = "menu3"
cp.Name = "filedate"
cp.PropertyName = "SelectedValue"
cp.DefaultValue = "12/31/2008"
ds.SelectParameters.Clear()
ds.SelectParameters.Add(cp)
up1.ContentTemplateContainer.Controls.Add(ds)
'--GridView --
Dim gridview3 As New GridView()
gridview3.DataSource = ds
'---Add controls to update panel and add update panel to site---
up1.ContentTemplateContainer.Controls.Add(gridview3)
pnl1.Controls.Add(up1)
'---Bind Datasource to gridview---.
gridview3.DataBind()
end sub
|
|
|
|
|
Alpine77 wrote: The following code works but.....
So if it works what is your problem? You want to know how to break it?
Yusuf
Oh didn't you notice, analogous to square roots, they recently introduced rectangular, circular, and diamond roots to determine the size of the corresponding shapes when given the area. Luc Pattyn[^]
|
|
|
|
|
Thanks for your reply, I should have been more specicific in the subject but was woried it was getting to long. The code will generate the menu grid and datasource but i have to click on the menu item twice before it will update the grid.
|
|
|
|
|
I think it is because your code is firing on every postback in the page_load.
You should use
if not ispostback
begin
end
Then put the databind code in the onclick event of the menu.
I didn't get any requirements for the signature
|
|
|
|
|
Thanks for the reply I am going to try this but I must first find out how to link and event to a dynamically created control. i believe I can use the AddHandler like below.
AddHandler Menu3.MenuItemClick, AddressOf Menu3_Click
Public sub Menu3_Click(ByVal sender as system.object,ByVal e as System.EventArgs)
'Databind code
End Sub
but it does not seem to be working. I will do some research and once I have this working I will let you know if moving this code from the page load fixes the original problem.
Thanks again.
|
|
|
|
|
|
Hi Dear
I use VS 2005, in Gridview i have a column that in the Basic Table have a relationship to other Table. I want like a combobox, show another field to the user, not show the forign key.
How can i do that?
|
|
|
|
|
Hi,
Explain your problem in detail. As no one can make out what your problem is. Your foreign key issue you should handle from sql query.
I guess your solution is the "DataKeyNames" property of gridview.
|
|
|
|
|
Hi Dear
I use VS 2005. in a gridview i set one of numeric column DataFormat String to {0:N} and a number like 123456 at out put is like : 123,456,00
but i want to omit the decimal. like : 123,456
how can i do that?
|
|
|
|
|
I think DataFormatString="{0:###,###,###}" will work.
I didn't get any requirements for the signature
|
|
|
|
|
Thanks , it work correctly.
|
|
|
|
|
DataFormatString="{0:#,#}" is enough to make the trick hapen.
In Word you can only store 2 bytes. That is why I use Writer.
|
|
|
|
|
I am developing a web application in which i have used a dropdown list on which update panel is applied ,and on list select event I'll set some cs file variable values that are not visible on my javascript function all though the values of cs variable getchanged is there any way to solve these problem ?
thanks
|
|
|
|
|
either you have no clue of what you doing or you did not explain your problem.
Abhishek Rana wrote: I am developing a web application in which i have used a dropdown list on which update panel is applied
So far so good
Abhishek Rana wrote: and on list select event I'll set some cs file variable values that are not visible on my javascript function
If all you want to do is handle the select changed event in javascript, why do you need updatepanel? Update panel is used/needed only if you have to process the event on the server, so you don't refresh the whole page.
Abhishek Rana wrote: on list select event I'll set some cs file variable values that are not visible on my javascript function all though the values of cs variable getchanged
No there is no way you can access the variables from javascript.
Abhishek Rana wrote: is there any way to solve these problem ?
Yes, Since you have update panel, forget about javascript and handle what ever you want on the server. Things will work for you magically.
Yusuf
Oh didn't you notice, analogous to square roots, they recently introduced rectangular, circular, and diamond roots to determine the size of the corresponding shapes when given the area. Luc Pattyn[^]
|
|
|
|
|
Yusuf wrote: Abhishek Rana wrote:
is there any way to solve these problem ?
Yes, Since you have update panel, forget about javascript and handle what ever you want on the server. Things will work for you magically.
Funny.
But I agree with Yusuf. Unless you are writing a website that will be very high volume, it is always easist and cleanest to just write your code in C# and use the ajax panel. It is one thing if you are proficient with asp.net, html, javascirpt and it easy for you. But if you are not an expert, don't even bother trying to use a bunch of javascript. You will probably just shoot yourself in the foot.
I didn't get any requirements for the signature
|
|
|
|
|
Hi Dear
I registered as ASPSpider.com member. I uploaded my Database and ASP.NET 2005 files in my space, but when i connected to the address http://aspspider.info/sasannaderi/ (you can see it online) this error occured :
Keyword not supported: 'integrated security'.
My connectionStrings is this :
<connectionStrings>
<add name=sasannaderi_maskan Data
Source=.\SQLExpress;Persist Security Info=True;Integrated
Security=SSPI;Initial Catalog=sasannaderi_maskan
providerName=System.Data.SqlClient/>
</connectionStrings>
Can anyone help me to solve the problem?
|
|
|
|
|
Integrated Security=SSPI means using Windows Authentication. Does that give you a clue?
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
I set it to True, but it don't work!
the project on my local system work as well.
|
|
|
|
|
Windows authetication works well in local environment. But not in deployed environment. Thats whay you are getting this problem. You have to use Sql Server authentication with proper userid and password.
Thanks,
Arindam D Tewary
|
|
|
|
|
In ASPSpider.com (Free Learning & Training Hosting)you can add only SQL Express database and in the guide, tell you that chang your connectionstring to this :
"Data Source=.\SQLExpress;Persist Security Info=True;Integrated Security=SSPI;Initial Catalog=YourUserId_DatabaseName"
i change my connectionstring to above format, but it don't work yet!
|
|
|
|
|
I am sure that they have advised that considering that indevidual would be working ( rather practising ) in their local system when you have SQL Express and application(which is accessed) is in the same COMPUTER.
But if you have your code(application) which you try to see using HTTP , then you have to go for SQL Server authentication unless you have the ACCESS TO DATABASE AND YOU CAN CONFIGURE THE SAME DATABASE TO ALLOW WINDOWS AUTHETICATION FOR DEPLOYED APPLICATION.
BUT IN MOST CASES, database never allows WINDOWS AUTHENTCATION for deployed application, i.e application which are accessed using HTTP.
Thanks,
Arindam D Tewary
|
|
|
|