|
Either save it under the web root and just use a URL and Response.Redirect to open it, or use the System.IO classes to stream it to the browser.
|
|
|
|
|
Dear all, I've a stranger problem here with the grid view, mine, is allowing paging with Pagersettings mode = 'NextPreviousFirstLast
each time i click the last page from the first page for the example, i got an index out of range exception cause it set the new index page = 2147483647..
can anybody help?
|
|
|
|
|
i have one dropdown list and i bind it but:
i want the content of dropdown list be Id and name
like: 1203/Frank
can u help me???????
|
|
|
|
|
Hi there,
You can change your datasource before binding it to ddl, you might have to change the SQL query to something like "select id+'/'+name...."
Anyway you should check the query again as I'm not sure if it's correct or not
<< >>
|
|
|
|
|
hi
thats not right i did that in asp.net(c#).
what should i write in this code insted of *
dropdownlist.datatextfield = "*";
|
|
|
|
|
hi
I dont know about this solution, but IMO if selecting datatextfield="*", that means all fields will be shown in ddl, right? if so, what is the delimeter between these fields?
Re. my suggestion, I think it's also correct as you just select 2 fields (id and name) and combine these into one field as your format, then just bind the combined field to ddl (SQL: select id+'/'+name as combinedfield....)
<< >>
|
|
|
|
|
Hi,
I think u can do it in Asp.NET and also in the SQL query. I just tried the same. Here it is...
SELECT ct.intUSCityId, ct.strUSCityName,CAST(ct.intUSCityId AS VARCHAR(50)) + '/' + ct.strUSCityName AS Vaib ,ct.isDeleted FROM tbCity AS ct
WHERE ct.intUSCountyId=10
To bind it to the dropdownlist
DropdownList.DataTextField = "Vaib";
DropdownList.DataValueField = "intUSCityId";
The other one ofcourse by concatenating ID+ "/" + "Name" in Asp.NET
It's working fairly well. So, I think u can use any of these methods
Thanks for reading,
Vaibhav
|
|
|
|
|
Hi,
I think u must be returning a DataSet to bind it to the dropdown containing "ID" and "Name"...You can do following to display "ID/Name" to DropdownList where ID & Name are column names u return through ur query.
if(ds!=null && ds.Tables.Count > 0)
{
if( ds.Tables[0].Rows.Count > 0)
{
ds.Tables[0].Columns.Add("strDisplay",typeof(System.String));
for(int i = 0 ; i < ds.Tables[0].Rows.Count;i++)
{
ds.Tables[0].Rows[i]["strDisplay"] = ds.Tables[0].Rows[i]["ID"] +"/" + ds.Tables[0].Rows[i]["Name"] ;
}
}
}
And to bind the dropdownlist
DropdownList.DataTextField = "strDisplay";
DropdownList.DataValueField = "Value";
I think this should work fine...
Thank u,
Vaibhav
|
|
|
|
|
yes sure it should work, but to be more efficient you can do this from SQL query....No need to load data into dataset and loop over all records in dataset to create the third column
<< >>
|
|
|
|
|
ya..That's a useful advice...
Thanks a lot..
|
|
|
|
|
You can use expression column in datatable. In this method, no need to loop through all the records.
Regards
R.Arockiapathinathan
|
|
|
|
|
Thanks a lot.. I tried this one and it's really very good
solution.
Thanks a lot for the help.
Thanks & regards,
Vaibhav
|
|
|
|
|
thanks for your help yes thats right.
|
|
|
|
|
hello sir,
can u tell me
how to create control from one string.
that is,
System.Web.UI.Control ctl =new WebDateChooser();
instead of this ,i have the bellow one,but it shows error (cannot convert string to
control)
System.Web.UI.Control ctl = "new WebDateChooser()";
plz help me sir..
bye
sureshkumar
|
|
|
|
|
Hi there,
I still not got ur clue How can you assign a string to an object?????
IMO, no way to assign a string to an object
<< >>
|
|
|
|
|
i dont want to assign string to an control.
but i want to create a control using string.
that is my input is "WebDateChooser"
using this input i need to genarate cotrol.
eg: WebDateChooser ctl=new WebDateChooser();
plz tell the solution.
sureshkumar
|
|
|
|
|
if so, just create control basing on the input string....
if you still got the problem, it'd be easier if you post the snippet of code here...
<< >>
|
|
|
|
|
I think that it's better if you explain what you are trying to accomplish, instead of asking how to do it the way that you think that it is done.
---
b { font-weight: normal; }
|
|
|
|
|
Hai,
How I can execute a javascript after a post back event occured.Please help me by showing the right way...
Thank You,
Siju Thomas.
|
|
|
|
|
Hi there,
IMO, just simply using Response.Write(yourJSCodehere) to client
<< >>
|
|
|
|
|
Enjoycrack,
Thanks much for your response.But when I tried this I couldn't see the expected result.That is it is executing the script and the html is rendered to the page.I don't want this.When I tried with 'RegisterStartupScript' it was working and showing the executing the javascript after rendered the html.But still it is showing the posting back after executing the script.I dreally need first complete the post back and execute the script. Means after the execution of the script no remaining post back should happen..
Any way is there...
Thank You,
Siju Thomas.
|
|
|
|
|
Hi,
I still cannot think of which situation that you want to do that...
But anyway, if you just want to execute js code and not do post back after executing js code, just simply return false in your js code as "return false" causes browser not post back to server
Hope you get the idea
<< >>
|
|
|
|
|
Hi
Place below code after post back event handler
If Not IsClientScriptBlockRegistered("anyNameToIdentify") Then
RegisterClientScriptBlock("anyNameToIdentify", "alert('here ya go !')")
..........
..........
|
|
|
|
|
Enjoycrack , arv169,
Thanks very much for your responses.I have given more explanation about my issue to get the proper solution.
Please see the function given below,
Private Sub MyMessage(ByVal strMsg As String)<br />
Dim strScript As String = "<script language=JavaScript> "<br />
' strScript += "window.onload=alert('hai alert');"<br />
'strScript += "alert(""" & strMsg & """);"<br />
If (strMsg <> "") Then<br />
If (strMsg = "CLOSE") Then<br />
strScript += "window.close();"<br />
Else<br />
strScript += strMsg<br />
End If<br />
End If<br />
<br />
'strScript += "return false;"<br />
strScript += "</script>"<br />
'Response.Write(strScript)<br />
If (Not Page.IsStartupScriptRegistered("clientScript")) Then<br />
Page.RegisterStartupScript("clientScript", strScript)<br />
'Page.RegisterClientScriptBlock("clientScript", strScript)<br />
End If<br />
End Sub
Here 'strMsg' is the javascript which comes from user specification(Means user can execute any javascript).
I have executed it under 'Page_Load' event after doing every operation.
Here it is rendering the html and executing the javascript.This one I required. But the only one problem comes is after executing the javascript only it completes the post back. that is the status bar remains in half when executing javascript and ends the post back.
I need it should complete the post back and execute the javascript.
For example if i specify the script:- alert('hai'); it must show the message after the posting back complete.
Currently it is showing the message half the way of post back and when i click ok button of the alert message box it is completing the post back..
I beleve you got the point..
Any chance....
|
|
|
|
|
Put the javascript code in a function, and call that function from the onload event in the body tag.
---
b { font-weight: normal; }
|
|
|
|