|
Hi,
I was trying to sort a GridView programitically but my code is throwing an System.StackOverflowException.Please have a look at the code below and reply what wrong I m doing.
protected void GridView2_Sorting(object sender, GridViewSortEventArgs e)
{
GridView2.Sort("CarrierCode", SortDirection.Descending);
}
CarrierCode is the name of a column above.
Thanks.
|
|
|
|
|
You are getting a stack overflow operation because this event occurs when the hyperlink to sort a column is clicked, but before the GridView control handles the sort operation.
GridView.Sorting Event
[^]
What is happening is your GridView2_Sorting function is executing which calls the sort method. This in turn will cause your GridView2_Sorting function to handle the sorting event thus getting stuck in a loop until the stack overflow exception is raised.
See C# GridView Sorting at http://quickstarts.asp.net/QuickStartv20/aspnet/doc/ctrlref/data/gridview.aspx[^]
for help with sorting.
Jim
|
|
|
|
|
Hi all,
I have already found the approaches to access server-side controls of a user control (e.g <asp:label> <asp:textbox> ...) on IE,
var obj = document.getElementById('uctAUserConrolID_AServerSideControlID'); //or
var obj = document.getElementById('uctAUserConrolID:AServerSideControlID'); //or
BUT, these approaches don't work on Firefox!!!
please let me know if anyone know the answer.
Thanks
Ming
|
|
|
|
|
Correct me if i'm wrong, but firefox doesn't use getElementbyId, does it?
|
|
|
|
|
Hi,
The firefox do use getElementbyId, because I tried this piece of code below to get the client-side controls within a user control , it works.
var obj = document.getElementById('AClientSideControl');
|
|
|
|
|
By the way,I use the latest version of firefox.
|
|
|
|
|
Firefox uses getElementById .
|
|
|
|
|
It would appear that indeed i am wrong...
|
|
|
|
|
You can view the HTML ViewSource in both IE and Firefox. And find out what the name of your element. then, I think you will get some idea how to get the object of your element in Javascript. If not, can you please the name of your name which is shown in the viewsource of IE and Firefox.
|
|
|
|
|
Hi Michael,
Thanks for your help, I did use the way you suggested. The HTML ViewSource for the asp:net control in both IE and Firefox are actually same:
For Firefox:
<input name="UctLogin1:txtEmail" type="text" id="UctLogin1_txtEmail" />
For IE:
<input name="UctLogin1:txtEmail" type="text" id="UctLogin1_txtEmail" style="width:200px;" />
Regards,
Ming
|
|
|
|
|
var obj = document.getElementById("UctLogin1_txtEmail"); doesn't work? You got the error or got nothing? Have you tried to debug your javascript by using Firebug?
|
|
|
|
|
No, it doesn't work with getElementById, no error shown in Firefox error console.
the result show null. but anyway, getElementsByName works ..
|
|
|
|
|
Hi Michael,
Problems solved, I use getElementsByName with its name in HTML ViewSource instead of ID, it works!
It seems like the getElimentById function still does not work compatiblely with firefox very well.
Regards,
Ming
|
|
|
|
|
okay.. great!
|
|
|
|
|
Oh dear! I just found out what I said was wrong.
getElementById function works as well!!
|
|
|
|
|
hello everybody
on my grid view i have a select command button. on gridview select click i want to pass memberID and propductID of that row and fill up modal popup with member details and product details.
any instruction will be really helpful.
thanks in advance
Sarfarj Ahmed
|
|
|
|
|
Use the button's CommandArgument and CommandName property to store the memberID and propductID as in:
<br />
<asp:Button id="btnPopUp" CssClass="btnStyle0" Text="View product" CommandArgument='<%#DataBinder.Eval(Container.DataItem, "memberID").ToString()%>' CommandName='<%#DataBinder.Eval(Container.DataItem, "propductID").ToString()%>' runat="server"><br />
</asp:Button>
Add a click evnet to the butten as in:
<br />
void btnPopUp_Click(object sender, EventArgs e)<br />
{<br />
Button btn = (Button)sender;<br />
memberID = int.Parse(btn.CommandArgument);<br />
propductID = int.Parse(btn.CommandArgument);<br />
Then use this values to get the data you need and push out an PopUp.
Remember to add the buttons clik event in the GridView's OnItemCreated.
Hope it helps
Thomas
|
|
|
|
|
Hello Friends,
When we use Servert.Transfer and set it's second parameter true then sometime it throws error
Can anybody let me know y it's happened ????????????????/
|
|
|
|
|
You haven't stated what error your are experiencing. However, the MSDN documentation states
Transfer calls End, which throws a ThreadAbortException exception upon completion.
This would not be affected by the value of the preserveForm parameter, which simply determines whether the QueryString and Form collections are preserved.
<blockquote class="FQ"><div class="FQA">The Knowledge wrote:</div>Can anybody let me know y it's happened ????????????????/ </blockquote>
Is the '?' key stuck on your keyboard?
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
hi,
how to give backcolor for a label in datagrid byselecting colors from database.
i tried like this
<asp:Label ID="lblcolore" runat="server" BackColor= '<%# Eval("colorname") %>' Width="100" Height="20" ></asp:Label>
Any one please help!!
modified on Friday, December 07, 2007 8:26:36 AM
|
|
|
|
|
Is this label in template column? If yes, you can find this label in RowCreated event or RowDataBound and then set the backcolor.
For example ~
<br />
RowCreated or RowDataBound<br />
<br />
Label lbl = (Label)e.Row.FindControl("lblColore");<br />
lbl.BackColor =
<br />
|
|
|
|
|
Thank you for your reply!!
but it wont work
here is my code:
Protected Sub dgFatturato1_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.WebControls.GridItemEventArgs) Handles dgFatturato1.ItemDataBound
Using connection As New SqlConnection(ConfigurationManager.ConnectionStrings.Item("BoschConnectionString").ToString)
connection.Open()
Dim str As String
str = "SELECT colorname FROM ACC_COLORI_FATTURATO"
Dim adpt As New SqlDataAdapter(str, connection)
Dim ds As New DataSet
adpt.Fill(ds, "ACC_COLORI_FATTURATO")
If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Then
If ds.Tables(0).Rows.Count > 0 Then
Dim fieldcolor As String
Dim i As Integer
For i = 0 To ds.Tables(0).Rows.Count - 1
fieldcolor = ds.Tables(0).Rows(i).Item(0).ToString
'DataBinder.Eval(e.Item.DataItem, "colorName")
'Dim lbl As Label
'lbl = CType(e.Item.FindControl("lblColore"), Label)
'lbl.BackColor = System.Drawing.Color.FromName(fieldcolor)
''To convert the value of Type String to System.Drawing.Color
e.Item.BackColor = Color.FromName(fieldcolor)
Next
End If
End If
end using
end sub
please help!!
|
|
|
|
|
Can anyone give me sample of code using QuerString (e.g passing ang retriving value)
A key to every Solution
|
|
|
|
|
URL: www.somewhere.com/test.aspx?name=bob
Code:
string theName;
theName = Request.Querystring("name");
Response.Write(theName);
|
|
|
|
|
Hi,
you can set multiple QueryString
<br />
string tempURL = "~/MySite.com/Welcome.aspx?Name=" +MyName+ "&Surname="+MySurname;<br />
Now on Welcome.aspx page you can get this both values like this.
<br />
if(Request.QueryString.Count>0)<br />
{<br />
if(Request.QueryString["Name"].ToString()!=null)<br />
{<br />
Name= Request.QueryString["Name"];<br />
}<br />
if(Request.QueryString["MySurname"].ToString()!=null)<br />
{<br />
MySurname = Request.QueryString["MySurname"];<br />
}<br />
}<br />
Regards...
|
|
|
|