|
But I don't have access to the gridview in SearchButton_Click
I already tried DataPager1.DataBind(); and it didn't work
|
|
|
|
|
Try
gvResults.DataSource = theSource;
gvResults.DataBind();
SearchButton_Click
thatraja |Chennai|India|
Brainbench certifications Univotes are like kid's kisses don't reject it Do what you want quickly because the Doomsday on 2012 My childhood story
|
|
|
|
|
I tried it, still no luck
|
|
|
|
|
Swiftain wrote: still no luck
I never believe that.
what's the error message? mention that too.
thatraja |Chennai|India|
Brainbench certifications Univotes are like kid's kisses don't reject it Do what you want quickly because the Doomsday on 2012 My childhood story
|
|
|
|
|
There's no error message, it just displays blank. But like I said when the same code snippet is placed in the Page_Load event, it displays the data.
|
|
|
|
|
I tried it myself, but not success at all with that.
I can provide you alternate way.
Just change your SearchButton_Click event with following snippets.
protected void SearchButton_Click(object sender, EventArgs e)
{
string[] myData = {"10", "20", "30"};
GridView gview = (GridView)DataPager1.FindControl("gvResults");
gview.DataSource = myData;
gview.DataBind();
}
|
|
|
|
|
Thanks Hiren for your response, what you posted will work but the only problem is that I need to manipulate the data on the user control, not on the web page itself. So I just wanted a way to pass data from the web page unto the user control and then manipulate it from there. Funny thing is that it works on the Page_Load event but doesn't on the button_click event!
|
|
|
|
|
Swiftain wrote: Funny thing is that it works on the Page_Load event but doesn't on the button_click event!
I've experimented a thing already with that, But didn't find any solution for the same, Let me try other way I will let you know once I got the clue.
If you're finding the solution then please put here so that it could be useful further for a members and also me.
|
|
|
|
|
See THIS[^], It might be useful.
|
|
|
|
|
Instead binding the data on Page_Load event of the user control, I created a method for doing the same thing and it worked. I think the reason is because the Page_Load even of the user control fires and then that of the page fires too which happens automatically, so in order to force a bind, I had to create a simple method like this
public void BindData()
{
gvResults.DataSource = TheSource;
gvResults.DataBind();
}
and then on web page, I just did this
protected void SearchButton_Click(object sender, EventArgs e)
{
DataPager1.TheSource = myData.ToList();
DataPager1.BindData();
}
Now that works, but now it looks as though the gridview events from the user control like "OnRowCreated" ain't firing. Oh well, at least I've got one bit working
|
|
|
|
|
Yes, That's the way. Thanks for sharing solution.
Swiftain wrote: "OnRowCreated" ain't firing
Will try to solve it as getting enough time.
|
|
|
|
|
Hi All,
I am working in a asp project, in which now i have a requirement to take the screen shot of the aspx page that is visible on the client browser.
can any one please let me know how to do the same .
thanks in advance..
|
|
|
|
|
I don't have much Idea on whether it is possible from clientside or not. As javascript is only available to you.
But I found THIS[^] to be useful so far.
|
|
|
|
|
Navigate the Given link
Link[^]
Hope it Will work for you.
|
|
|
|
|
Hi All,
I've to send SMS from My web Application (I'm using ASP.NET VB). My SMS API is on .php site. Here is a Sample.
Dim MyString, CellNo As String
MyString = "Message"
CellNo = "Cell No"
Dim Http As HttpWebRequest = WebRequest.Create("http://208.101.14.59/api/pushsms.php?usr=USERID&pwd=PASSHERE&sndr=SENDERID&ph=" & CellNo & "&text=" & MyString & "&rpt=1")
Dim resp As HttpWebResponse = req.GetResponse()
OR USING THIS METHOD
Dim Http As HttpWebRequest = WebRequest.Create("http://208.101.14.59/api/pushsms.php?usr=USERID&pwd=PASSHERE&sndr=SENDERID&ph=" & CellNo & "&text=" & MyString & "&rpt=1")
Http.Method = "GET"
Using WebResponse As HttpWebResponse = Http.GetResponse()
Dim responseStream As Stream = WebResponse.GetResponseStream()
Dim reader As StreamReader = New StreamReader(responseStream, Encoding.Default)
Dim html As String = reader.ReadToEnd()
responseStream.Close()
End Using
When I use this I Get Error Like:
An attempt was made to access a socket in a way forbidden by its access permissions 208.101.14.59:80
I google it and got many solutions which were not usefull finally I contacted my Server Administrator and they told me that they doesn't supports Browsing Feature to other sites from their server. So I use following code :
Session("CellNo")="CellNo"
Session("SMSMess") ="Messagetext"
Dim newWin As String = ("<script language='javascript'>" + "window.open('msgstat.aspx' , 'Print', 'height=200, width=220, menubar=no, toolbar=no, scrollbars=no, resizable=no'); </script>")
ClientScript.RegisterStartupScript(Me.GetType(), "pop", newWin)
I openes Popup Window. My Code on Popup Window:
Design:
<script language="javascript" type="text/javascript">
function CloseMe() {
window.close()
}
</script>
<body style="background:#2C6494;" topmargin="15px" leftmargin="0" onload="CloseMe()">
<form id="form1" runat="server" style="background:#2C6494;">
<div style="background:#2C6494">
<iframe runat ="server" id ="ravi" frameborder="0" height="1px" width="1px" />
<br /><br /><br /><br />
<div align="center">
<b>Updating details...Please wait..</b>
</div>
</div>
</form>
</body>
CodeBehind:
Try
Dim myString As String = "http://208.101.14.59/api/pushsms.php?usr=USERID&pwd=PASSHERE&sndr=SENDERID&ph=" & Trim(Session("CellNo")) & "&text=" & Trim(Session("SMSMess")) & "&rpt=1"
ravi.Attributes.Add("src", myString)
Catch ex As Exception
Response.Write("Error Occured")
End Try
It works Fine. When I Click on Send Button Popup opens and SMS sends successfully. Ok with 1 SMS But What about Bulk Messages How could I Use it. Can anyone helps me?
Thanx
|
|
|
|
|
Please Re-format your Code to make it readability.
|
|
|
|
|
Hi all,
i inserted my data into the database with the html tags. I am trying to show those data in the gridveiw but without html tags. Is it possible to do this ? Any Ideas ??
suchita
|
|
|
|
|
You obviously need to strip the html elements either going to the or coming from the database. Use a RegEx to find and remove them from the text.
What issues are you encountering?
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
when i was showing in the datagrid, because of some html tags, the starting text is not aligned. Some are left aligned of the cell, while some are right aligned and some are center. I want the uniformity in all when they are displayed in the datagrid.
suchita
|
|
|
|
|
If you want uniformity in alignment then make it happen. You are in complete and absolute control of the html that is rendered.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Mark Nischalke wrote: Use a RegEx
um... you might want to read this rant[^]...
[edit]
This[^] exposition of it is also interesting
|
|
|
|
|
Just that, a rant. The response of Chuck Norris can do it is spot on though.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
I found this Regex to detect HTML Tags.
\<\/?\w+\>
Literal <Literal /,zero or one repetationsAlphanumeric, one or more repetitionsLiteral >Which Matches to almost HTML tags, Just replace matched string with Empty of "" String. and you will get plain text as a OUTPUT I think.
[Add]
See my recent TIP[^] on CP for that.
[/Add]
|
|
|
|
|
Problem is solved already....
suchita
modified on Wednesday, December 15, 2010 3:32 PM
|
|
|
|
|
hai experts
i need a gauge control in asp.net with out third party tools is .can u please suggest me how to design a circular gauge control in asp.net .it is very urgent requirement please help me out
Regards
venu
|
|
|
|