|
You can force a postback by examining the javascript that does it in general. Or you can make an AJAX call.
Christian Graus
Please read this if you don't understand the answer I've given you
"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 )
|
|
|
|
|
Hello,
I need to capture the user response to a confirm dialog. if the user clicks cancel, the postback is cancelled and I want to do something else even if its a cancel. I just use the clientscript.registerstartupscript to show a confirm dialog. What should I be doing to accomplish what i wish to?
|
|
|
|
|
if you are using a button...
OnClientClick="return confirm('Sure??');"
This will prevent the postback if user selects cancel
and will submit the form if the user selects ok
Alexei Rodriguez
|
|
|
|
|
i have a repeater in my asp page and there is a bool record in my database lets call it photo
if its true it means user uploaded a photo so user photo must be shown in imgPhoto control
but if its false it means default photo must be shown
anyone can help me to do it?
here is my code:
<asp:Repeater ID="RepeaterComments" runat="server" DataSourceID="SqlDatSrcComments">
<ItemTemplate>
<table style="width: 100%" cellspacing="0" cellpadding="0">
<tr>
<td style="width: 50%;text-align: left;background-color: #F0F0F0;">
<asp:Image ID="imgPhoto" runat="server"
ImageUrl='<%# Eval("UserID", "~/Photos/Users/Small/{0}.jpg") %>'
ToolTip='<%# Eval("Nickname") %>' Height="16px" Width="16px"/>
<asp:HyperLink ID="hypLnkCommentUsername" runat="server" CssClass="InfoLink"
NavigateUrl='<%# Eval("UserID", "~/Profile.aspx?UserID={0}") %>'><%# Eval("Nickname") %></asp:HyperLink>
</td>
</tr>
</table>
</ItemTemplate>
</asp:Repeater>
|
|
|
|
|
<% if (whatever) {%>
emit your HTML here
<% } %>
Christian Graus
Please read this if you don't understand the answer I've given you
"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 )
|
|
|
|
|
Try this:
ImageUrl = '<%# IIF (Eval("boolColumn"), Eval("UserID", "~/Photos/Users/Small/{0}.jpg"), "DefaultImageURL") %>'
Alexei Rodriguez
|
|
|
|
|
Won't this only work if the code behind is VB ?
Christian Graus
Please read this if you don't understand the answer I've given you
"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 guess, im not sure if IIF is supported in c#, but there must be something similar, isnt there?
I just hope this guy gets the idea
If he is using c#, he will have to find something similar
But im not sure what language he is using
How can you tell he is using c#?
Alexei Rodriguez
|
|
|
|
|
(boolean expression) ? if true : if false is in C#. I don't know what he's using, I'd hope the syntax I am showing worked for both, I do try to use language agnostic constructs where I can.
Christian Graus
Please read this if you don't understand the answer I've given you
"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 )
|
|
|
|
|
Hi
I have 2 tables in database as follows:
table1:
id name state id
1 aaa 1,2
2 bbb 1,3
table2:
id state
1 ak
2 ny
3 jk
so the problem is that I want to display all the data of "table1" in a gridview and in place of "state id" I want to display "statename", for example in place of "1,2" I want to display "ak,ny".
How to do this?
Please help me .
Thanks
|
|
|
|
|
Are you asking for help with building an SQL statement?
If so, it might look like this:
Select t1.*, t2.State as StateAcro from table1 as t1 inner join table2 as t2 on (t1.id=t2.id)
Otherwise, could you elaborate a bit more?
|
|
|
|
|
Hi
Thanks for replying.
ids in table1 are seperated with commas so t1.id=t2.id will not work.
I need asp.net code to display table1 values as I explained in my previous post.
Thanks
|
|
|
|
|
Seems to me like you need to design your db better in future ( a joining table would have made this doable in the SQL ).
You can read your array of state names and Ids, then write a data binding statement that passes the id string to the code behind, where you use the split method and a string builder to build a string that contains the state abbreviations.
Christian Graus
Please read this if you don't understand the answer I've given you
"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 )
|
|
|
|
|
Hi Christian
Thanks for reply
Actually I am displaying names of states in a checkbox list and after submitting the form, storing selected checkbox stateids in database with stateids seperated by comma as in table1.
If you have any working example or else any suggestion, please send it.
Thanks
|
|
|
|
|
What I said. A joining table joins data where there's an arbitrary number of joins
id name state id
1 aaa 1,2
2 bbb 1,3
table2:
id state
1 ak
2 ny
3 jk
table3:
nameId, stateId
1, 1
1, 2
2, 1
2, 3
then table 1 loses the stateID column.
Christian Graus
Please read this if you don't understand the answer I've given you
"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 )
|
|
|
|
|
hi,
i have a to add a reference dll to my asp.net web application. i'm going to solution explorer and clicking on add reference and selecting a dll for reference. but i'm not getting references folder in the solution explorer. can any body tell what is the problem and how can i add a dll as reference.
thanks for your help
M.MohanVamsi
|
|
|
|
|
I believe you just add it to your bin folder and then refer to it from there.
Christian Graus
Please read this if you don't understand the answer I've given you
"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 )
|
|
|
|
|
Hi,
please i need a button to work on more than one validation group.
Mohammad Al Hoss
|
|
|
|
|
OK - I don't know if you can specify more than one group, if not, you have to dig into the javascript that the framwork generates and write your own code to call the different groups.
Christian Graus
Please read this if you don't understand the answer I've given you
"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 )
|
|
|
|
|
How will the button know what group to validate??
Whats your scenario??
Maybe there could be another way
Alexei Rodriguez
|
|
|
|
|
hi,
I think this link will explain exactly what i want
http://www.peterblum.com/DES/DemoGroup.aspx?B=1
Thanks
Mohammad Al Hoss
|
|
|
|
|
Hello,
I have a db that stores phone numbers in the following format: (###) ###-####. I would like to reformat the phone number to the this format (for mobile apps to pick up the number for dialing): ###-###-####. I have used the following line of code to attempt this reformatting but am still getting the phone number displayed in its original format.
<itemtemplate>
<asp:label runat="server" id="lblContact" text="">]]>'/>
Can anyone help me with this? Thanks in advance to all those that reply.
|
|
|
|
|
you can write it in your sql statement I think:
SELECT field,field2, FORMAT (Telephone,' (###)-##-#######' ) AS NewPhone FROM table
|
|
|
|
|
Hello .netman,
I tried what you suggested and received the following error: 'Format' is not a recognized function name. I think this function is only applicable to MS Access and not SqlServer. However, I was able to do this through using the Substring function and extracting smaller strings of the phone number and concatenating them back together. Thanks for leading down the right road.
|
|
|
|
|
You can use a regular expression to reformat the string:
VB:
<![CDATA[<%# System.Text.RegularExpressions.Regex.Replace(Eval("Work_Phone"), "\((\d+)\) (\d+)-(\d+)", "$1-$2-$3") %>]]>
C#:
<![CDATA[<%# System.Text.RegularExpressions.Regex.Replace(Eval("Work_Phone"), @"\((\d+)\) (\d+)-(\d+)", "$1-$2-$3") %>]]>
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|