|
Use the onclick method of the anchor tag to call javascript which redirects if appropriate. Set the href to #.
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 )
|
|
|
|
|
The situation is , i have a gridview that contains one rows ,
1.for hyperlink - for each row it has information for ten records , if the information pertaining to ten records are there in the database , then on clicking the hyperlink it shows the details of ten records , currently it shows what ever is there in database, i mean there may be 2 or 3 records information.
so that's y i want to restrict the user to first fill the complete information for ten records , only then u can view.
so i can either pop up a message box or i can make the hyperlink enable or disable.
in bothe the cases , i need to access the databas eto check the no of entries.
so what should i do?
Soniagupta1@yahoo.co.in
Yahoo Messenger Id = soniagupta1
-- modified at 7:24 Wednesday 7th November, 2007
|
|
|
|
|
You can make a hyperlink disabled by setting the href to # or an empty string. You can control it better by using onclick, then it can be dynamic.
You should get your info from the database when your grid is databound, and generate hyperlinks only if they are required. If you want it to update while the user is viewing the page, then you need to use AJAX, but I'd say that's overkill.
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 )
|
|
|
|
|
Christian Graus wrote: then you need to use AJAX
With Sonia this would be a can. of. worms.
|
|
|
|
|
i know pyramid building needs time.
Thank You Sir
Soniagupta1@yahoo.co.in
Yahoo Messenger Id = soniagupta1
|
|
|
|
|
Yes, but in your case you would ask where each and every block would need to be placed, rather than building on previous knowledge gained in laying out the base.
So, yes, I like your analogy.
|
|
|
|
|
Sonia Gupta wrote: so what should i do?
STFW!
|
|
|
|
|
Hi,
I have a function in javascript which is called on 'onload ' event of the body. This function, takes the values from windows.dialogArguments and assigns it to textbox1.text. After this assignment, I want to call a server side function. But my problem is that, the server side function gets executed first before javascript function gets executed. How can I make it sequential?
Here's the situation with example:
javascript function
function LoadFunc()
{
var val=window.dialogArguments;
document.form1.txtMessage.value=val;
<%databind()%> -- server side function.
}
This function is called on 'onload' event of the body tag. But the problem is databind() gets executed first!
Any help is greatly appreciated....
Thanks,
|
|
|
|
|
I would look into PageMethods, its an ajax thing which allows you to call server side code from javascript.
|
|
|
|
|
Is it an ASP.NET AJAX thing ? AJAX itself doesn't have anything like that AFAIK.
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 )
|
|
|
|
|
Sorry, should have mentioned that its part of the ASP.net AJAX framework, i am not sure if its included in any others.
|
|
|
|
|
I know about ajax and Icallback interfaces also,why dont you guys think in a different way...
|
|
|
|
|
this is my code---
protected void btnSearch_Click1(object sender, EventArgs e)
{
string strDropdown = drpdwnAnalystName.SelectedItem.Text;
string strSecurityCode = txtSecurityCode.Text;
string strFromDate = dtpFrom.Text;
if (drpdwnAnalystName.SelectedItem.Value == strDropdown && txtSecurityCode.Text == "" && dtpFrom.Text == "")
{
funSearchAnalyst();
}
if (txtSecurityCode.Text == strSecurityCode && drpdwnAnalystName.SelectedItem.Value == "" && dtpFrom.Text == "")
{
funSearchSecurityCode();
}
if (dtpFrom.Text == strFromDate && txtSecurityCode.Text == "" && drpdwnAnalystName.SelectedItem.Value == "")
{
funSearchFromDate();
}
funStyle();
funClear(); txtSecurityCode.Text = "";
drpdwnAnalystName.SelectedItem.Text = "";
}
fist if case only run. in second if cursor is not go to inside if condition.
it is directly go to 3 rd if condition there also not go to inside
if condition.
what wrong in this code
Gayatri
|
|
|
|
|
It's a repost
niki_nilu wrote: fist if case only run. in second if cursor is not go to inside if condition.
it is directly go to 3 rd if condition there also not go to inside
if condition.
what wrong in this code
Debug the application, put breakpoints and check what value you are getting.
|
|
|
|
|
niki_nilu wrote: drpdwnAnalystName.SelectedItem.Text = "";
Here you are replacing the text of the selected item. Is that really what you intended, or are you just trying to remove the selection?
niki_nilu wrote: fist if case only run. in second if cursor is not go to inside if condition.
it is directly go to 3 rd if condition there also not go to inside
if condition.
What are you trying to say? The only information that I managed to get from that is that there is some difference between the first and second time you run the code...
Experience is the sum of all the mistakes you have done.
|
|
|
|
|
1. when select analyst name that time analyst name wise search success.
2. when i write security code that time cursor is go on if condition but not go on funSearchSecurityCode().directly go on 3rd if ()
3. when i select date in the calender that time cursor is go on if condition but not go on funSearchFromDate(). it directly go on funStyle();
funClear(); txtSecurityCode.Text = "";
drpdwnAnalystName.SelectedItem.Text = "";
this code.
now pls tell me what is wrong.
Gayatri
|
|
|
|
|
The code that you have written doesn't make much sense, so it's not surprising if it doesn't work.
You are comparing the value and the text of the selected item in a drowdown list. Do you have any items in the dropdown list where the text and the value are the same?
You are putting the text in a textbox into a variable, then comparing the text in the textbox with the value of the same variable. That doesn't make any sense as that condition will always be true, even if the textbox is empty.
You are comparing the value of the selected item in the dropdownlist to an empty string. Do you have any item in the dropdown list where the value is an empty string?
Experience is the sum of all the mistakes you have done.
|
|
|
|
|
I create a button at the bottom of the page... while i click the button it should go to the top of the page without refreshing...Any ideas or suggestions is more helpful....
Thanks in Advance...
|
|
|
|
|
You can make use of anchor in HTML. Create anchor on the top of page, and link to yourpage.aspx#anchorname , will take you to the place where anchor is created.
|
|
|
|
|
Hi guys.
i can explain for my doubt with example.see.my table have multiple type of employee details like as Mangemment,Programmer,Designers,Accountants,Contra ctEmployees.Each type of department having many employee details.Now my drop down list having types of department names like that above types of department names..if i select any one type of department data wil be display in gridview format .gridview data column as employee Name,Address,Phone_No,email_address and each every row with checkboxes.gridview showing data according to select the dept.No problem.
first I select Mangemment type of employee grid view showing that type of employee details ,here i checked first two employee details then checkbox values put in one viewstate,then i go to Programmer type of employee it showing that type employee details here i want to checked two employee details using checkbox but what happened first two checkboxes are already checked. so view state having proper checked check box values but problem is
whenever i go to select for another type of employee details checkboxes are checked based upon order of previous checked index.
this is my problem.plz clear my problem.its very urgent.
whenever i select dropldown list viewstate values is empty . this is my problem.
Thanigaimani.thirumalai
|
|
|
|
|
Do you check checkbox values of dropdownlist selected event?
bEst rEgard
pAthan
please don't forget to vote on the post that helped you.
|
|
|
|
|
Hi
i checked checkbox values of dropdown list selected index changed event,values are coming from viewstate,so we want viewstate values add plus new checked checkbox values ,but if i click display button control that viewstate values are removing then new checked checkbox values are only diaplay .
see my code behind..
i can bold where i used viewstate and i can underlined the code of viewstate values are removing( i mean previous page checked checkbox values).
<br />
<br />
<br />
Protected Sub gridview1_PageIndexChanging(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewPageEventArgs) Handles gridview1.PageIndexChanging <br />
<br />
gridview1.PageIndex = e.NewPageIndex<br />
<br />
getselected()<br />
<br />
databind1("First_name", "asc") <br />
<br />
setSelected()<br />
<br />
<br />
End Sub<br />
<br />
------------------<br />
<br />
Public Sub getselected() <br />
<br />
<br />
<br />
Dim arrayListContactGroup As New ArrayList <br />
<br />
<br />
If ViewState("ArrayList") IsNot Nothing Then<br />
<br />
arrayListContactGroup = CType(ViewState("ArrayList"), ArrayList) <br />
<br />
ViewState.Remove("ArrayList") <br />
<br />
<br />
<br />
End If<br />
<br />
For Each row As GridViewRow In gridview1.Rows <br />
<br />
<br />
<br />
Dim chkselectcontacts As CheckBox = CType(row.FindControl("chksel"), CheckBox)Dim arraylistlabel As Label = CType(row.FindControl("contid"), Label) <br />
<br />
<br />
<br />
If chkselectcontacts.Checked Then <br />
<br />
<br />
<br />
If Not arrayListContactGroup.Contains(arraylistlabel.Text) Then <br />
<br />
arrayListContactGroup.Add(arraylistlabel.Text)<br />
<br />
<br />
<br />
End If <br />
<br />
<br />
<br />
Else <br />
<br />
<br />
<br />
If arrayListContactGroup.Contains(arraylistlabel.Text) Then <br />
<br />
arrayListContactGroup.Remove(arraylistlabel.Text)<br />
<br />
<br />
End If <br />
<br />
<br />
<br />
End If <br />
<br />
<br />
<br />
Next <br />
<br />
ViewState("ArrayList") = arrayListContactGroup <br />
<br />
-------------------<br />
<br />
Public Sub setSelected() <br />
<br />
<br />
<br />
Dim arrayListContactGroup As New ArrayList <br />
<br />
<br />
<br />
If ViewState("ArrayList") IsNot Nothing Then<br />
<br />
arrayListContactGroup = CType(ViewState("ArrayList"), ArrayList) <br />
<br />
<br />
End If<br />
<br />
For Each row As GridViewRow In gridview1.Rows <br />
<br />
<br />
<br />
Dim chkselectcontacts As CheckBox = CType(row.FindControl("chksel"), CheckBox)Dim arraylistlabel As Label = CType(row.FindControl("contid"), Label) <br />
<br />
<br />
<br />
If arrayListContactGroup.Contains(arraylistlabel.Text) Then <br />
<br />
chkselectcontacts.Checked = True <br />
<br />
<br />
<br />
Else <br />
<br />
chkselectcontacts.Checked = False <br />
<br />
<br />
<br />
End If <br />
<br />
<br />
<br />
Next <br />
<br />
<br />
<br />
End Sub <br />
<br />
-------------------------- <br />
<br />
<br />
Protected Sub Selcon_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Selcon.SelectedIndexChanged <br />
<br />
getselected()<br />
<br />
databind1(ViewState("sort"), ViewState("ascdesc"))<br />
<br />
setSelected()<br />
<br />
<br />
<br />
End Sub <br />
<br />
My problem is,arraylist values(checkbox values) stored in viewstate,viewstate get the values no problem,but whenever i go to dropdown list select index change at that time we want add viewstate values and current checked checkbox values,but its doing opposite side operation i mean removing the view state value.see i can underlined that line.<br />
<br />
Plz urgent hepl me <br />
<br />
<div class="ForumSig">Thanigaimani.thirumalai</div>
|
|
|
|
|
Hi
i checked checkbox values of dropdown list selected index changed event,values are coming from viewstate,so we want viewstate values add plus new checked checkbox values ,but if i click display button control that viewstate values are removing then new checked checkbox values are only diaplay .
see my code behind..
i can bold where i used viewstate and i can underlined the code of viewstate values are removing( i mean previous page checked checkbox values).
Protected Sub gridview1_PageIndexChanging(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewPageEventArgs) Handles gridview1.PageIndexChanging
gridview1.PageIndex = e.NewPageIndex
getselected()
databind1("First_name", "asc")
setSelected()
End Sub
------------------
Public Sub getselected()
Dim arrayListContactGroup As New ArrayList
If ViewState("ArrayList") IsNot Nothing Then
arrayListContactGroup = CType(ViewState("ArrayList"), ArrayList)
ViewState.Remove("ArrayList")
End If
For Each row As GridViewRow In gridview1.Rows
Dim chkselectcontacts As CheckBox = CType(row.FindControl("chksel"), CheckBox)Dim arraylistlabel As Label = CType(row.FindControl("contid"), Label)
If chkselectcontacts.Checked Then
If Not arrayListContactGroup.Contains(arraylistlabel.Text) Then
arrayListContactGroup.Add(arraylistlabel.Text)
End If
Else
If arrayListContactGroup.Contains(arraylistlabel.Text) Then
arrayListContactGroup.Remove(arraylistlabel.Text)
End If
End If
Next
ViewState("ArrayList") = arrayListContactGroup
-------------------
Public Sub setSelected()
Dim arrayListContactGroup As New ArrayList
If ViewState("ArrayList") IsNot Nothing Then
arrayListContactGroup = CType(ViewState("ArrayList"), ArrayList)
End If
For Each row As GridViewRow In gridview1.Rows
Dim chkselectcontacts As CheckBox = CType(row.FindControl("chksel"), CheckBox)Dim arraylistlabel As Label = CType(row.FindControl("contid"), Label)
If arrayListContactGroup.Contains(arraylistlabel.Text) Then
chkselectcontacts.Checked = True
Else
chkselectcontacts.Checked = False
End If
Next
End Sub
--------------------------
Protected Sub Selcon_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Selcon.SelectedIndexChanged
getselected()
databind1(ViewState("sort"), ViewState("ascdesc"))
setSelected()
End Sub
My problem is,arraylist values(checkbox values) stored in viewstate,viewstate get the values no problem,but whenever i go to dropdown list select index change at that time we want add viewstate values and current checked checkbox values,but its doing opposite side operation i mean removing the view state value.see i can underlined that line.
Plz urgent hepl me
-- modified at 2:06 Thursday 8th November, 2007
Thanigaimani.thirumalai
|
|
|
|
|
hi,
The problem im facing is that when i open the solution of an asp.net project the .NET returns this error. "Visual Studio .NET cannot open or create the application. The likeliest problem is that the required components are not installed on the local web server. Im using Visual Studio .NET 2003 and Framework is 1.1.
thanx.
|
|
|
|
|
You need IIS installed (V 5.0 or higher if I recall). You also need to register ASP.NET with IIS using aspnet_regiis .
|
|
|
|