|
Hi,
I have a repeater in my aspx page. The datasource for this will change for different types of call hence I cannot do
<ItemTemplate>
<tr >
<td bgcolor="" valign="top">
<%#DataBinder.Eval(Container.DataItem, "Id")%>
</td>
...
</tr>
</ItemTemplate>
as the dataItem will be different. Which is the best way to do it server side?
Thanks,
|
|
|
|
|
If you want to use DataBinding like this you would need to convert each datasource to use the same columns, with the same names. Not a bad thing. If the datasources will all have different columns with different types you may want to use a DataGrid and set AutoGenerateColumns=true;
Otherwise, you will need to manually add ITemplates to your repeater based on the selected datasource
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
yes I had set the autogenerate columns as true and it works fine.
Issue is I also had a jquery to select the selected row value and it ended up having lots of magic numbers for the colums in different states. Very difficult to understand and maintain. I want to access dataItem value on row click and hence trying to map dynamically .
Thanks,
|
|
|
|
|
How can I get server side validators to work with JQuery UI Modal with validation groups ?
|
|
|
|
|
Query has nothing to do with server side code. If you want they server side validation events to fire then have the page do a post back.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Actually the problem was modal being attached outside of tag. Can you suggest any other jquery validation plugin which emulates validation groups on asp.net webforms ?
|
|
|
|
|
If the controls are not inside a form tag it doesn't matter, the validators won't work anyway. Is there a reason you need to use a server validation method? You can't use Page_Vaiidate("validation group name") within javascript?
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
I have different jQuery UI Modal dialogs on a webform. I need to emulate validation groups on each UI Modal so I was trying server side validators because I could not emulate validation groups with jQuery. I did not knew about page_validate previously. What do you suggest ? Should I just fire the server validation groups with Page_Validate or do I use a separate plugin ?
|
|
|
|
|
Page_Validate will not fire server validation methods, it will perform the validations on the client.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
hi , i've added some labels to my webform at runtime . the "runat" attribute is set to "server" . now i want to get each label's innertext by severside controls like <asp:button>.
how to get the runtime made labels via asp?
|
|
|
|
|
If you created the controls at run time rather than in the aspx markup then you need to recreate the controls during a post back in order for them to be recognized again.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
so i cant use my ideas . thx
|
|
|
|
|
As i said, if the controls are created dynamically then they must also be recreated during apostback. There are many examples of this. Most server controls use this technique.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Correct
Wonde Tadesse
MCTS
|
|
|
|
|
As Mark said, In order to work with controls that are created in runtime, you must recreate the controls each time a postback is occurred.
Wonde Tadesse
MCTS
|
|
|
|
|
You can use it's Parent's FindControl method like this:
var lbl = document.getElementById('<%= parentConrol.FindControl('myLabel').ClientID %>');
var text = lbl.innerHTML;
|
|
|
|
|
good , but there is another problem with testing this way, the parent controls are being added runtime. and the Id of controls is identified by user at runtime too.anyway, thank u .
|
|
|
|
|
Not even close to what the OP was asking for. I guess you missed the part about server side.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
If you see the OP's response to my solution, you can infer that s/he actually meant accessing the innerHTML using a javascript method called from a button's onclick.
|
|
|
|
|
Shameel wrote: s/he actually meant
And we can infer from this that you are a mind reader. Does that make it true or correct?
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Mark Nischalke wrote: And we can infer from this that you are a mind reader. I'm not a mind reader, but I have the mental ability to infer from the word 'innerText' in the original question that the OP wants to read the contents at the client side. Had it been server side, s/he wouldn't have used the word 'innerText'. Mere mention of a server side button does not necessarily mean that the OP wants to do it on the server side.
"Don't confuse experts with facts" - Eric_V
|
|
|
|
|
Let's break down the OPs statements
oujeboland wrote: the "runat" attribute is set to "server"
runat=server? Seems to infer the label control in question will be a server control, either and ASP.NET Label or a GenericHtmlElement of type label. Don't see any JavaScript involved here. Unless you infer some method to insert JavaScript and have the controls processed by the ASP.NET engine.
oujeboland wrote: get each label's innertext by severside controls
Oh, yes, there is mention if the word innerText. However, notice the "by serverside controls". Still can't do JavaScript on the server, unless again, you are inferring some technique for which I'm not aware of.
Now look at your inferred solution.
var lbl = document.getElementById('<%= parentConrol.FindControl('myLabel').ClientID %>');
var text = lbl.innerHTML;
The OP mentioned server-side twice and dynamically creating controls in that context. You offer a JavaScript solution.
You are using expression syntax which means embedding the JavaScript within the page so it will be processed by the ASP.NET engine. A poor design to begin with and still doesn't address the OPs needs.
We could continue this, and I have no doubt you will try, however, it doesn't change the fact you offered a poorly designed solution that doesn't address the OPs needs. What can be inferred from that?
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Hiiiiiiii to all
Dear sir
any one can give link where to get about THREE TIER project in ASP.NET WEBSERVICES good tutorial and and also download small project THREE TIER programming in ASP.NET WEBSERVICES
rizvan sivally
|
|
|
|
|
Ummm, a web service is one of the tiers.
Once you understand what "n-tier" actually means, you'll understand the previous statement.
Google is your friend.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997
|
|
|
|
|
Dear sir
actually i m working with tier programming with Data Layer,Business Layer,Presentation layer, with asp.net c#,if you have any link of webservices with 3 tier tutorial with small project,please send me
Thanking you
rizvan sivally
|
|
|
|